One Hat Cyber Team
Your IP :
216.73.216.216
Server IP :
194.44.31.54
Server :
Linux zen.imath.kiev.ua 4.18.0-553.77.1.el8_10.x86_64 #1 SMP Fri Oct 3 14:30:23 UTC 2025 x86_64
Server Software :
Apache/2.4.37 (Rocky Linux) OpenSSL/1.1.1k
PHP Version :
5.6.40
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
vo
/
.npm
/
registry.npmjs.org
/
puppeteer
/
View File Name :
.cache.json
{"_id":"puppeteer","_rev":"871-1c9368836af7a009ce09eb29d702ac07","name":"puppeteer","description":"A high-level API to control headless Chrome over the DevTools Protocol","dist-tags":{"latest":"8.0.0","chrome-67":"1.3.0","chrome-68":"1.4.0","chrome-69":"1.6.2","chrome-70":"1.7.0","chrome-71":"1.9.0","chrome-72":"1.11.0","chrome-73":"1.12.2","chrome-74":"1.13.0","chrome-66":"1.1.1","chrome-65":"1.0.0","chrome-75":"1.15.0","chrome-76":"1.17.0","chrome-77":"1.19.0","chrome-78":"1.20.0","chrome-79":"2.0.0","chrome-81":"3.0.0","chrome-80":"2.1.0","chrome-83":"3.1.0","chrome-85":"5.2.1","chrome-84":"5.1.0","chrome-86":"5.3.1"},"versions":{"0.0.0":{"name":"puppeteer","version":"0.0.0","description":"A script for setting up and installing new Ubuntu machines with Puppet","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/plus3network/puppeteer.git"},"keywords":["puppet","devops","install","ubuntu"],"author":{"name":"Chris Cowan"},"license":"MIT","gitHead":"730fbe50ac90eeaf2a5f02859b258b5dd2dbe92b","_id":"puppeteer@0.0.0","dist":{"shasum":"c71ff3ced0cf60fc7d9faa4d66e9c5e8c3a2a12a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-0.0.0.tgz"},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"ccowan","email":"chriscowan@plus3network.com"},"maintainers":[{"name":"ccowan","email":"chriscowan@plus3network.com"}],"directories":{}},"0.9.0":{"name":"puppeteer","version":"0.9.0","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=7.10.0"},"scripts":{"unit":"jasmine test/test.js","debug-unit":"DEBUG_TEST=true node --inspect-brk ./node_modules/.bin/jasmine test/test.js","test-phantom":"python third_party/phantomjs/test/run-tests.py","test-doclint":"jasmine utils/doclint/check_public_api/test/test.js && jasmine utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-phantom && npm run test-doclint","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run doc","doc":"node utils/doclint/cli.js","coverage":"COVERAGE=true npm run unit"},"author":{"name":"The Chromium Authors"},"license":"SEE LICENSE IN LICENSE","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","mime":"^1.3.4","progress":"^2.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"494755"},"devDependencies":{"commonmark":"^0.27.0","deasync":"^0.1.9","eslint":"^4.0.0","esprima":"^4.0.0","jasmine":"^2.6.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1"},"gitHead":"3ce173c16bb9e8ae27ef148507c1bc2e1979645d","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@0.9.0","_npmVersion":"5.3.0","_nodeVersion":"8.2.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-wlmYlLIQsySYnxFQxXTMp1ACB5oMyHI6y2pCJ4YoVqyp0Uml3T+HS64jGimxOD3x93T3G+FM3JI3nBmHCovNgA==","shasum":"d65997ff83e24eb569e5577d2f75695dcbe5be4a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-0.9.0.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-0.9.0.tgz_1502897081168_0.33841979457065463"},"directories":{}},"0.10.0":{"name":"puppeteer","version":"0.10.0","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"jasmine test/test.js","debug-unit":"DEBUG_TEST=true node --inspect-brk ./node_modules/.bin/jasmine test/test.js","test-phantom":"python third_party/phantomjs/test/run-tests.py","test-doclint":"jasmine utils/doclint/check_public_api/test/test.js && jasmine utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-phantom && npm run test-doclint && npm run test-node6","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run doc","doc":"node utils/doclint/cli.js","coverage":"COVERAGE=true npm run unit","node6":"node utils/node6-transform/index.js","test-node6":"jasmine utils/node6-transform/test/test.js","build":"npm run node6","node6-sanity":"jasmine test/sanity.js"},"author":{"name":"The Chromium Authors"},"license":"SEE LICENSE IN LICENSE","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"496140"},"devDependencies":{"commonmark":"^0.27.0","deasync":"^0.1.9","eslint":"^4.0.0","esprima":"^4.0.0","jasmine":"^2.6.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1"},"gitHead":"751164c69fa32907ad35cf86daca1b4ba3b658e3","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@0.10.0","_npmVersion":"5.3.0","_nodeVersion":"8.4.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-Ufww/sWuySwkvTgeTetIVa/zhco4SnuBa5jtINLypEK0USDLTkYbVCsRwatcOvlwfr8Idb+JiNbpXt/kkhdsNA==","shasum":"f0a95de4b2660608fa9dbc54f525d013ef6262e7","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-0.10.0.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-0.10.0.tgz_1503623848895_0.6312760452274233"},"directories":{}},"0.10.1":{"name":"puppeteer","version":"0.10.1","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"jasmine test/test.js","debug-unit":"DEBUG_TEST=true node --inspect-brk ./node_modules/.bin/jasmine test/test.js","test-doclint":"jasmine utils/doclint/check_public_api/test/test.js && jasmine utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run doc","doc":"node utils/doclint/cli.js","coverage":"COVERAGE=true npm run unit","test-node6-transformer":"jasmine utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"jasmine node6-test/test.js"},"author":{"name":"The Chromium Authors"},"license":"SEE LICENSE IN LICENSE","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"496140"},"devDependencies":{"commonmark":"^0.27.0","deasync":"^0.1.9","eslint":"^4.0.0","esprima":"^4.0.0","jasmine":"^2.6.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1"},"gitHead":"ea4f8d78fce605fbcf00ad2d08acca075c1d9f29","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@0.10.1","_shasum":"a26f7012ff0fcc9f21c70ff9e2a8c60cba568a83","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.4.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"a26f7012ff0fcc9f21c70ff9e2a8c60cba568a83","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-0.10.1.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-0.10.1.tgz_1503715407407_0.8126345055643469"},"directories":{}},"0.10.2":{"name":"puppeteer","version":"0.10.2","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"jasmine test/test.js","debug-unit":"DEBUG_TEST=true node --inspect-brk ./node_modules/.bin/jasmine test/test.js","test-doclint":"jasmine utils/doclint/check_public_api/test/test.js && jasmine utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run doc","doc":"node utils/doclint/cli.js","coverage":"COVERAGE=true npm run unit","test-node6-transformer":"jasmine utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"jasmine node6-test/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"497674"},"devDependencies":{"commonmark":"^0.27.0","eslint":"^4.0.0","esprima":"^4.0.0","jasmine":"^2.6.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1"},"gitHead":"2817130fe099a7431e98c20ce1f44c6e547d4ca9","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@0.10.2","_npmVersion":"5.3.0","_nodeVersion":"8.4.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-dj1MdwiYfEwTemfFeBu0inGyhcaEe3cKREvTFSA/pkGHaCwyj/FFfJHJpr9vykXvSs/PbmcApOztsUyqzd1msA==","shasum":"b4a959a722bf626ca481f2aeba11fdb810f2c98f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-0.10.2.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-0.10.2.tgz_1504325092003_0.5746091885957867"},"directories":{}},"0.11.0":{"name":"puppeteer","version":"0.11.0","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"jasmine test/test.js","debug-unit":"DEBUG_TEST=true node --inspect-brk ./node_modules/.bin/jasmine test/test.js","test-doclint":"jasmine utils/doclint/check_public_api/test/test.js && jasmine utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run doc","doc":"node utils/doclint/cli.js","coverage":"COVERAGE=true npm run unit","test-node6-transformer":"jasmine utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"jasmine node6-test/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"499413"},"devDependencies":{"commonmark":"^0.27.0","eslint":"^4.0.0","esprima":"^4.0.0","jasmine":"^2.6.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1"},"gitHead":"433b17b5d28569a30b47ce894a3305cb192935ce","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@0.11.0","_npmVersion":"5.3.0","_nodeVersion":"8.4.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-/o8uY6VChG74B1HYBZkLDU6aIekWeOd85wez9YxB9SNbDnFNsUddv2F4xWuhwvQ4ab84vb+1VX4fxs2kBz3u8g==","shasum":"0a2b856f3c2745a5884c6dde9fb44f96663988ed","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-0.11.0.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-0.11.0.tgz_1505972831445_0.6909726415760815"},"directories":{}},"0.12.0":{"name":"puppeteer","version":"0.12.0","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"jasmine test/test.js","debug-unit":"cross-env DEBUG_TEST=true node --inspect-brk ./node_modules/jasmine/bin/jasmine.js test/test.js","test-doclint":"jasmine utils/doclint/check_public_api/test/test.js && jasmine utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"jasmine utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"jasmine node6-test/test.js","tsc":"tsc -p ."},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"508693"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","jasmine":"^2.6.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"next"},"gitHead":"b555151c14f736dea7344d834211128e5e45ede6","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@0.12.0","_npmVersion":"5.3.0","_nodeVersion":"8.4.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-H/bylN7FccwbN7JZoSP+xRozxgJEDNy4uC4p727cyttKUVNXYjFuEMueJYHW0pblnrfLEH341SyFJVWhJMLxKQ==","shasum":"9c421930851594dfdd479d07646666a74ced7719","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-0.12.0.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-0.12.0.tgz_1508000185901_0.9672713316977024"},"directories":{}},"0.13.0":{"name":"puppeteer","version":"0.13.0","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"jasmine test/test.js","debug-unit":"cross-env DEBUG_TEST=true node --inspect-brk ./node_modules/jasmine/bin/jasmine.js test/test.js","test-doclint":"jasmine utils/doclint/check_public_api/test/test.js && jasmine utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"jasmine utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"jasmine node6-test/test.js","tsc":"tsc -p ."},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"515411"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","jasmine":"^2.6.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"0467c346b1a23608001dd66d9fe49f147600baa6","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@0.13.0","_npmVersion":"5.3.0","_nodeVersion":"8.4.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-M52SA/WmW54YMLzFtCLGslhr9tntzfTgJIZnx3QnaDXn9F5q2BlTosywSBEKj8aVVd6al0WNfiu14MUQW3wjaw==","shasum":"2e6956205f2c640964c2107f620ae1eef8bde8fd","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-0.13.0.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-0.13.0.tgz_1510367096371_0.7907098056748509"},"directories":{}},"1.0.0-rc":{"name":"puppeteer","version":"1.0.0-rc","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"524617"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"e32fdcb5bc2e2cec6368ac4b11be8d22b8553024","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.0.0-rc","_npmVersion":"5.0.3","_nodeVersion":"8.1.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-QxruMhDYCHvbdLvA63IG1/1eZTrrPL1GgoeKszf7Se7mLFjp5ioJ8MXrZtci4zDb+HQco9sbgqfJuSr9gKcYdA==","shasum":"79214e18fd21e62b7957da1ddc4195aad6c5f854","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-rc.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-rc.tgz_1514500308981_0.6181684541516006"},"directories":{}},"1.0.0-next.1514510476874":{"name":"puppeteer","version":"1.0.0-next.1514510476874","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"524617"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"bd73e4b7b814f0a9df97158f9102e486618c6075","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1514510476874","_shasum":"2d677cb4437d8031421566751b6dea946638c044","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"2d677cb4437d8031421566751b6dea946638c044","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1514510476874.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1514510476874.tgz_1514510486072_0.1084796607028693"},"directories":{}},"1.0.0-next.1514951743425":{"name":"puppeteer","version":"1.0.0-next.1514951743425","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"524617"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"d0623819785c91d262b7c5e8037cd67b606375a4","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1514951743425","_shasum":"38b4107a90abf28aa8d6e3412c8b48c973b09bfc","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"38b4107a90abf28aa8d6e3412c8b48c973b09bfc","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1514951743425.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1514951743425.tgz_1514951754624_0.9590171831659973"},"directories":{}},"1.0.0-next.1515022965203":{"name":"puppeteer","version":"1.0.0-next.1515022965203","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"524617"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"f183664d0f187649671d8d0086cbb016e0b24651","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515022965203","_shasum":"e82a8c707869753ed617e95c4c7ce7babf74fbe0","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"e82a8c707869753ed617e95c4c7ce7babf74fbe0","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515022965203.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515022965203.tgz_1515022970862_0.9222261749673635"},"directories":{}},"1.0.0-next.1515032607003":{"name":"puppeteer","version":"1.0.0-next.1515032607003","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"524617"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"24354a4879849c8cb4e50cfcae83d78f65938a93","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515032607003","_shasum":"93fa3328b29fd761d6aace5c874398e8d501bafd","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"93fa3328b29fd761d6aace5c874398e8d501bafd","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515032607003.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515032607003.tgz_1515032615994_0.19684669352136552"},"directories":{}},"1.0.0-next.1515061835903":{"name":"puppeteer","version":"1.0.0-next.1515061835903","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"524617"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"0a498bae3a53357f5b793595b3c411183efd9536","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515061835903","_shasum":"ffb3645ab691c07a7f44a9a3c3601950e3190a5c","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"ffb3645ab691c07a7f44a9a3c3601950e3190a5c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515061835903.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515061835903.tgz_1515061849274_0.20424709259532392"},"directories":{}},"1.0.0-next.1515092222354":{"name":"puppeteer","version":"1.0.0-next.1515092222354","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"3481f03b805ecb76c2a91f35bb64c89892df2220","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515092222354","_shasum":"968249fe6c2e5b035bdc4f698288b363291aec11","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"968249fe6c2e5b035bdc4f698288b363291aec11","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515092222354.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515092222354.tgz_1515092236003_0.1389599614776671"},"directories":{}},"1.0.0-next.1515094434782":{"name":"puppeteer","version":"1.0.0-next.1515094434782","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"f0b11ad22ee0a3f98436f816de88a20c631d7c75","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515094434782","_shasum":"9c423124078219c572c0e9dc142e6a66c34a60e8","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"9c423124078219c572c0e9dc142e6a66c34a60e8","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515094434782.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515094434782.tgz_1515094446740_0.9390968868974596"},"directories":{}},"1.0.0-next.1515095370840":{"name":"puppeteer","version":"1.0.0-next.1515095370840","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"e7eacd443fa484465e864e877fa28dc997a0b3c5","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515095370840","_shasum":"57050fbc70d711665a78895624deab91d6e42741","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"57050fbc70d711665a78895624deab91d6e42741","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515095370840.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515095370840.tgz_1515095381292_0.009514454286545515"},"directories":{}},"1.0.0-next.1515096688553":{"name":"puppeteer","version":"1.0.0-next.1515096688553","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"ed3fc4706917d6eeff9a34d8b524293cb78b86ab","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515096688553","_shasum":"c00be069edfd6497fc24275c6e2d6dc3b4b0ee79","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"c00be069edfd6497fc24275c6e2d6dc3b4b0ee79","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515096688553.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515096688553.tgz_1515096702499_0.03384640393778682"},"directories":{}},"1.0.0-next.1515102886297":{"name":"puppeteer","version":"1.0.0-next.1515102886297","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"32a7fd5f37963dbe9d22f9a2976fc1e3a0c80700","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515102886297","_shasum":"ccdc72baa5892399bb59c16e932529eeeb6623f0","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"ccdc72baa5892399bb59c16e932529eeeb6623f0","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515102886297.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515102886297.tgz_1515102898295_0.18650259100832045"},"directories":{}},"1.0.0-next.1515107202232":{"name":"puppeteer","version":"1.0.0-next.1515107202232","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"05b1aca21e5c2f221373d601d3b8ae6b2a984292","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515107202232","_shasum":"c97ca3cf6e965418c367fb75a7ef98d093cece15","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"c97ca3cf6e965418c367fb75a7ef98d093cece15","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515107202232.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515107202232.tgz_1515107212390_0.8231705941725522"},"directories":{}},"1.0.0-next.1515176243781":{"name":"puppeteer","version":"1.0.0-next.1515176243781","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"8e9c54a789c9d51f9861053b21565ad21a5ffe6f","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515176243781","_shasum":"b174a2a3f2aaf2da3aa5e117cd611bae7dae08b8","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"b174a2a3f2aaf2da3aa5e117cd611bae7dae08b8","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515176243781.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515176243781.tgz_1515176251699_0.4619058461394161"},"directories":{}},"1.0.0-next.1515449879873":{"name":"puppeteer","version":"1.0.0-next.1515449879873","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"972f44d32896aa3e8284f5e793c3f40dc0d62b20","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515449879873","_shasum":"9f4b1b1b3e9b4229619d3c1d6e0a92db33f8943a","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"9f4b1b1b3e9b4229619d3c1d6e0a92db33f8943a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515449879873.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515449879873.tgz_1515449890024_0.96295480360277"},"directories":{}},"1.0.0-next.1515453229229":{"name":"puppeteer","version":"1.0.0-next.1515453229229","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"7c9104e1bc118ad227c7c4ff81025d6107317f8a","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515453229229","_shasum":"91f708ddb34349a183e4a98f9d384a512e7b86e0","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"91f708ddb34349a183e4a98f9d384a512e7b86e0","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515453229229.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515453229229.tgz_1515453237873_0.25431453832425177"},"directories":{}},"1.0.0-next.1515460930569":{"name":"puppeteer","version":"1.0.0-next.1515460930569","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"8c392b7ee8b848e460fecc1158e1388aa7b8b954","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515460930569","_shasum":"e70efdefb19db8cdca7ccc67ba83c7c3f48652a9","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"e70efdefb19db8cdca7ccc67ba83c7c3f48652a9","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515460930569.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515460930569.tgz_1515460941206_0.5935465502552688"},"directories":{}},"1.0.0-next.1515463858907":{"name":"puppeteer","version":"1.0.0-next.1515463858907","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"d7d9623740eb40a586fcb55f83ce6c301de5ba38","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515463858907","_shasum":"a13b89365bf861c434a38a23210c4e27573ab36a","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"a13b89365bf861c434a38a23210c4e27573ab36a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515463858907.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515463858907.tgz_1515463869631_0.38030021567828953"},"directories":{}},"1.0.0-next.1515463970965":{"name":"puppeteer","version":"1.0.0-next.1515463970965","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"71089b08022d09c6a0fa20b5f0c770b5ef35ab07","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515463970965","_shasum":"b28b365b1c23af6267f06d41890c90c64d9bdb84","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"b28b365b1c23af6267f06d41890c90c64d9bdb84","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515463970965.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515463970965.tgz_1515463979709_0.4805980925448239"},"directories":{}},"1.0.0-next.1515544418139":{"name":"puppeteer","version":"1.0.0-next.1515544418139","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"dcc1b243950d985268bd7d105ddd518572e0f1b4","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515544418139","_shasum":"dc8da4b2b9c1a96cd34c06a96dd4275c424ccbfa","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"dc8da4b2b9c1a96cd34c06a96dd4275c424ccbfa","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515544418139.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515544418139.tgz_1515544427406_0.8309073315467685"},"directories":{}},"1.0.0-next.1515546200351":{"name":"puppeteer","version":"1.0.0-next.1515546200351","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"5843f6f77573df4f848bdca7ab5f2d4a47a64ed7","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515546200351","_shasum":"a2a36b6c28ea8bbc7da6f321875ba2074eb82881","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"a2a36b6c28ea8bbc7da6f321875ba2074eb82881","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515546200351.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515546200351.tgz_1515546687831_0.7494962646160275"},"directories":{}},"1.0.0-next.1515552562439":{"name":"puppeteer","version":"1.0.0-next.1515552562439","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"c29822d66318bc904b257153d377e5575ca8cc02","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515552562439","_shasum":"7fe05bc53e0102c9cb4edb2f2fa5e01a9ae9974d","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"7fe05bc53e0102c9cb4edb2f2fa5e01a9ae9974d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515552562439.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515552562439.tgz_1515552572012_0.2908561038784683"},"directories":{}},"1.0.0-next.1515563875372":{"name":"puppeteer","version":"1.0.0-next.1515563875372","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"f6b7c1331628dfb45a916ec5cd1f04e5ed61bf01","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515563875372","_shasum":"28b44991efa79e0b1e4a048219930a692c476379","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"28b44991efa79e0b1e4a048219930a692c476379","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515563875372.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515563875372.tgz_1515563885258_0.04659983771853149"},"directories":{}},"1.0.0-next.1515567769425":{"name":"puppeteer","version":"1.0.0-next.1515567769425","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"9634d13be2906b2a5dee1678a290a47107d99ca3","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515567769425","_shasum":"760f6d3274fde82908077560c3d27515858de44d","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"760f6d3274fde82908077560c3d27515858de44d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515567769425.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515567769425.tgz_1515567781471_0.1648210813291371"},"directories":{}},"1.0.0-next.1515568144024":{"name":"puppeteer","version":"1.0.0-next.1515568144024","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"3985dee54eb2ec02c38d2017df49de0f868d86bf","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515568144024","_shasum":"a3764af4f461d0521480b0c41dd6824d4ebcb607","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"a3764af4f461d0521480b0c41dd6824d4ebcb607","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515568144024.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515568144024.tgz_1515568154352_0.794600875582546"},"directories":{}},"1.0.0-next.1515618391320":{"name":"puppeteer","version":"1.0.0-next.1515618391320","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"ec8e40f1cb2d9214387bfbbc2e5dcf48b8db7148","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515618391320","_shasum":"2ef0ee2c999de1f0fdb9af74c3b83d650bc0fe1a","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"2ef0ee2c999de1f0fdb9af74c3b83d650bc0fe1a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515618391320.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515618391320.tgz_1515618403026_0.9909726993646473"},"directories":{}},"1.0.0-next.1515641713768":{"name":"puppeteer","version":"1.0.0-next.1515641713768","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"5368051610babf52e7df927c323d315a493fb56f","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515641713768","_shasum":"b6f979af3b8a12cb83c715c6347050bee624546a","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"b6f979af3b8a12cb83c715c6347050bee624546a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515641713768.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515641713768.tgz_1515641724033_0.05552374245598912"},"directories":{}},"1.0.0-next.1515659454855":{"name":"puppeteer","version":"1.0.0-next.1515659454855","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"9b06ed28ae72ee3aa6de1f8b534f51347320b4a6","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515659454855","_shasum":"3a6225125af2b74fdcc13b400c4e49c16b0b75a2","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"3a6225125af2b74fdcc13b400c4e49c16b0b75a2","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515659454855.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515659454855.tgz_1515659466543_0.8148582505527884"},"directories":{}},"1.0.0-next.1515702182453":{"name":"puppeteer","version":"1.0.0-next.1515702182453","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"891a5539bd12a7df1231b3f96bc8cc9aaf386301","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515702182453","_shasum":"96bb32e59742e3a4a22cb5e9c176d4a171a55134","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"96bb32e59742e3a4a22cb5e9c176d4a171a55134","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515702182453.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515702182453.tgz_1515702193635_0.09411512198857963"},"directories":{}},"1.0.0-next.1515707096515":{"name":"puppeteer","version":"1.0.0-next.1515707096515","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"d68033aeca234a93c9ac5298258a5d324748466a","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515707096515","_shasum":"826c87507d8d622cc4960c9387754474c918fa7b","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"826c87507d8d622cc4960c9387754474c918fa7b","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515707096515.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515707096515.tgz_1515707108937_0.06857414706610143"},"directories":{}},"1.0.0-next.1515712659552":{"name":"puppeteer","version":"1.0.0-next.1515712659552","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"12b57e31f386b1bd8845aba0246894fde8fe9ed8","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515712659552","_shasum":"50ef02f78428152e66fe6dc51d685c4cc18abd3d","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"50ef02f78428152e66fe6dc51d685c4cc18abd3d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515712659552.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515712659552.tgz_1515712670165_0.31360534648410976"},"directories":{}},"1.0.0":{"name":"puppeteer","version":"1.0.0","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"12b57e31f386b1bd8845aba0246894fde8fe9ed8","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.0.0","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-e00NMdUL32YhBcua9OkVXHgyDEMBWJhDXkYNv0pyKRU1Z1OrsRm5zCpppAdxAsBI+/MJBspFNfOUZuZ24qPGMQ==","shasum":"20f3bb6ad6c6778b4d1fb750e808a29fec0a88a4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0.tgz_1515729089858_0.9048394954297692"},"directories":{}},"1.0.0-next.1515733912424":{"name":"puppeteer","version":"1.0.0-next.1515733912424","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"aed70191463f4b9d6c7cfa601201632167cbf602","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515733912424","_shasum":"52198b0bd5e39d4447816c1cefbc1277f1758ba5","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"52198b0bd5e39d4447816c1cefbc1277f1758ba5","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515733912424.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515733912424.tgz_1515733924274_0.5364071456715465"},"directories":{}},"1.0.0-next.1515745145135":{"name":"puppeteer","version":"1.0.0-next.1515745145135","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"c866c175f8e7c581ba54fe75c5daf97206697b72","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515745145135","_shasum":"18a200349c5d1802e4c4292453ff78b113ef58f3","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"18a200349c5d1802e4c4292453ff78b113ef58f3","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515745145135.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515745145135.tgz_1515745157580_0.030814126832410693"},"directories":{}},"1.0.0-next.1515786200433":{"name":"puppeteer","version":"1.0.0-next.1515786200433","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"31a1f9ad70cc0442710060fb704eb0c0aee5d175","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1515786200433","_shasum":"73fc9a3ff9468e25f74edeb95d4a5d66ff40f407","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"73fc9a3ff9468e25f74edeb95d4a5d66ff40f407","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1515786200433.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1515786200433.tgz_1515786210586_0.12764269253239036"},"directories":{}},"1.0.0-next.1516189923095":{"name":"puppeteer","version":"1.0.0-next.1516189923095","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"59f6d42610452c71ef4834c1e30f6e1f524e817e","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1516189923095","_shasum":"a987b4a1d227fddd2e8bfcce4f170164b2a45490","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"a987b4a1d227fddd2e8bfcce4f170164b2a45490","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1516189923095.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1516189923095.tgz_1516189933605_0.7214193204417825"},"directories":{}},"1.0.0-next.1516255441715":{"name":"puppeteer","version":"1.0.0-next.1516255441715","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"49d3799e325c16cf3c1812bd3ebbdd659af4fe62","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1516255441715","_shasum":"b2ab14c4fe72d891c6897301b3aafdf921b24b5f","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"b2ab14c4fe72d891c6897301b3aafdf921b24b5f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1516255441715.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1516255441715.tgz_1516255453040_0.29894313984550536"},"directories":{}},"1.0.0-next.1516339380944":{"name":"puppeteer","version":"1.0.0-next.1516339380944","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"2bf42fd779b84c0bb72de3721805b43a6bc089fb","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1516339380944","_shasum":"80ea40bdff589eb4d7b97d3f0ee0732729ff833d","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"80ea40bdff589eb4d7b97d3f0ee0732729ff833d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1516339380944.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1516339380944.tgz_1516339391010_0.7335764509625733"},"directories":{}},"1.0.0-next.1516339397474":{"name":"puppeteer","version":"1.0.0-next.1516339397474","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"d2715d1c6f57e4b12614a50aef1a6966dfb95ba0","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1516339397474","_shasum":"e843ab7b4209145d8bd742db664753ddeade5e9e","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"e843ab7b4209145d8bd742db664753ddeade5e9e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1516339397474.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1516339397474.tgz_1516339413025_0.23469940153881907"},"directories":{}},"1.0.0-next.1516340514293":{"name":"puppeteer","version":"1.0.0-next.1516340514293","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"102f10cbc7ebc1b156b1a54f21ce9bdb917d6632","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1516340514293","_shasum":"20754223572a2df913d8d9855ad33258a9bc38c0","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"20754223572a2df913d8d9855ad33258a9bc38c0","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1516340514293.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1516340514293.tgz_1516340524888_0.47257021884433925"},"directories":{}},"1.0.0-next.1516351540753":{"name":"puppeteer","version":"1.0.0-next.1516351540753","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"62597bf89780a7fde91a350e5eabf3be15bde02d","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1516351540753","_shasum":"9e9b7a617708c45ebd3398277200f6f4cff4e642","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"9e9b7a617708c45ebd3398277200f6f4cff4e642","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1516351540753.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1516351540753.tgz_1516351552732_0.4220070799347013"},"directories":{}},"1.0.0-next.1516663116955":{"name":"puppeteer","version":"1.0.0-next.1516663116955","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"cb684ebbc4de271c7f2187f4e52c0b3a83cc0122","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1516663116955","_shasum":"3a918af4512f96f4374f54e0afc6e695c66dcc57","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"3a918af4512f96f4374f54e0afc6e695c66dcc57","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1516663116955.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1516663116955.tgz_1516663127958_0.33383537945337594"},"directories":{}},"1.0.0-next.1516666407998":{"name":"puppeteer","version":"1.0.0-next.1516666407998","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"797b561013bc3f4212fa90a2e044f97b7c30b5e6","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1516666407998","_shasum":"94bb3e4adc800ea3888abf00a0329d67e6eaabae","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"94bb3e4adc800ea3888abf00a0329d67e6eaabae","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1516666407998.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1516666407998.tgz_1516666417441_0.8409609855152667"},"directories":{}},"1.0.0-next.1516668517979":{"name":"puppeteer","version":"1.0.0-next.1516668517979","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"b61e67d00113c88068287d6890eef184d47a222e","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1516668517979","_shasum":"a5e5a3493c7836dbe355119975cd31a1782bdedf","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"a5e5a3493c7836dbe355119975cd31a1782bdedf","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1516668517979.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1516668517979.tgz_1516668528937_0.37263431772589684"},"directories":{}},"1.0.0-next.1516669982697":{"name":"puppeteer","version":"1.0.0-next.1516669982697","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"f2b6016354670ed8300285e0ae25894e3bc5c8e9","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1516669982697","_shasum":"76ec7d736d31da129b43f807a2742d78d5c81725","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"76ec7d736d31da129b43f807a2742d78d5c81725","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1516669982697.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1516669982697.tgz_1516669992631_0.5957310860976577"},"directories":{}},"1.0.0-next.1516857257758":{"name":"puppeteer","version":"1.0.0-next.1516857257758","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"5175d8e692966f1023111361856345d45a3a29c3","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1516857257758","_shasum":"759ec622fb090497afaae0f422ae0016840c0a57","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"759ec622fb090497afaae0f422ae0016840c0a57","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1516857257758.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1516857257758.tgz_1516857268613_0.32191742002032697"},"directories":{}},"1.0.0-next.1516857487583":{"name":"puppeteer","version":"1.0.0-next.1516857487583","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"189deb84c0ecf43f405961814aad840c1107ee85","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1516857487583","_shasum":"50478340a753013e65deb2722af250b86e2a6b49","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"50478340a753013e65deb2722af250b86e2a6b49","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1516857487583.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1516857487583.tgz_1516857498064_0.818119203671813"},"directories":{}},"1.0.0-next.1516920787679":{"name":"puppeteer","version":"1.0.0-next.1516920787679","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"ddc59b247282774ccc53e3cc925efc30d4e25675","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1516920787679","_shasum":"2df0f343dd1bbcdea0abb8eb6cf66d3eaea87187","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"2df0f343dd1bbcdea0abb8eb6cf66d3eaea87187","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1516920787679.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1516920787679.tgz_1516920802692_0.8341596915852278"},"directories":{}},"1.0.0-next.1517036516784":{"name":"puppeteer","version":"1.0.0-next.1517036516784","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"4886d038d5fffa7c380ab575f7b8c665d94f827a","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1517036516784","_shasum":"0057b3ce0141e583a84afb67f478f36a3ded485a","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"0057b3ce0141e583a84afb67f478f36a3ded485a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1517036516784.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1517036516784.tgz_1517036527115_0.8030337686650455"},"directories":{}},"1.0.0-next.1517354775230":{"name":"puppeteer","version":"1.0.0-next.1517354775230","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"bae44a82d8de82b7535fb5bc5eb4836ffd68d164","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1517354775230","_shasum":"bfa96cec0d3866c37969a0becda2bf5086facff4","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"bfa96cec0d3866c37969a0becda2bf5086facff4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1517354775230.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1517354775230.tgz_1517354790529_0.2866705823689699"},"directories":{}},"1.0.0-next.1517441618294":{"name":"puppeteer","version":"1.0.0-next.1517441618294","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"526987"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"1716a748aaa936449d7441cbfcf06149384788c2","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1517441618294","_shasum":"5c7a702163a2f06628aca7050b75e61b7584a4b7","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"5c7a702163a2f06628aca7050b75e61b7584a4b7","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1517441618294.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1517441618294.tgz_1517441630915_0.8817345767747611"},"directories":{}},"1.0.0-next.1517443479601":{"name":"puppeteer","version":"1.0.0-next.1517443479601","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"cfb728b09b31428a2ab61bb22ad0e5e0cb2070cc","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1517443479601","_shasum":"fc18e2aa8886e48d71fe640b365b8de64af98d70","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"fc18e2aa8886e48d71fe640b365b8de64af98d70","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1517443479601.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1517443479601.tgz_1517443489522_0.4654326345771551"},"directories":{}},"1.0.0-next.1517859708863":{"name":"puppeteer","version":"1.0.0-next.1517859708863","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"e998ac93250cc7279043831328b6f4f49bc244bb","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1517859708863","_shasum":"62e8299e1b6d150f879e8cbac0d95c5460ac674d","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"62e8299e1b6d150f879e8cbac0d95c5460ac674d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1517859708863.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1517859708863.tgz_1517859719522_0.2967345796059817"},"directories":{}},"1.0.0-next.1517864102118":{"name":"puppeteer","version":"1.0.0-next.1517864102118","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"37a1e17461ba7f24715fba71a735c64a3c4cf8ef","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1517864102118","_shasum":"fbd295b42ab7940e793abbba549f55378924bd54","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"fbd295b42ab7940e793abbba549f55378924bd54","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1517864102118.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1517864102118.tgz_1517864117317_0.9147706557996571"},"directories":{}},"1.0.0-next.1517870791213":{"name":"puppeteer","version":"1.0.0-next.1517870791213","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"bc6902623a32ae562273ec5ff8ce2b0b34ffec73","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1517870791213","_shasum":"45117f043b5ede6230e5e93f6e33bd0d07b0cfff","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"45117f043b5ede6230e5e93f6e33bd0d07b0cfff","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1517870791213.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1517870791213.tgz_1517870807387_0.8178816372528672"},"directories":{}},"1.0.0-next.1517871038246":{"name":"puppeteer","version":"1.0.0-next.1517871038246","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"48218fae8ad199ef121fe78f9da7714bd71b3f38","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1517871038246","_shasum":"84f27b6a39afd1cf4167720f02dc34cd8afc9f86","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"84f27b6a39afd1cf4167720f02dc34cd8afc9f86","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1517871038246.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1517871038246.tgz_1517871050549_0.18668062053620815"},"directories":{}},"1.0.0-next.1517871611925":{"name":"puppeteer","version":"1.0.0-next.1517871611925","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"660b65780f51d86ad615b7871bdf125b505624e6","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1517871611925","_shasum":"c67c5a4e9f021372173ca67789e184617de0d884","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"c67c5a4e9f021372173ca67789e184617de0d884","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1517871611925.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1517871611925.tgz_1517871623099_0.33555718581192195"},"directories":{}},"1.0.0-next.1517871854711":{"name":"puppeteer","version":"1.0.0-next.1517871854711","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"ecc3adc27909e3df11a292952e34ee60cf2b005e","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1517871854711","_shasum":"9ffa20cb366c14232a5dfd70cb29e7be82f0ccb6","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"9ffa20cb366c14232a5dfd70cb29e7be82f0ccb6","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1517871854711.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1517871854711.tgz_1517871865653_0.12903007306158543"},"directories":{}},"1.0.0-next.1517875514795":{"name":"puppeteer","version":"1.0.0-next.1517875514795","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"4046415f0152408376c470fe5882b7e966fa0910","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1517875514795","_shasum":"e176f5b3aeb99d3adde7a558fc2f377b3bb8b4cd","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"e176f5b3aeb99d3adde7a558fc2f377b3bb8b4cd","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1517875514795.tgz"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer-1.0.0-next.1517875514795.tgz_1517875525513_0.1028504460118711"},"directories":{}},"1.0.0-next.1518024831019":{"name":"puppeteer","version":"1.0.0-next.1518024831019","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"a363a733b7aa88be9a17190bcfa924b507d7b3da","readme":"# Puppeteer \n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n```\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~71Mb Mac, ~90Mb Linux, ~110Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description\nof the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n1. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n1. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n \n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n\n1. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these\nother frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1518024831019","_shasum":"b35ae977bc51cf5fda246fff772351a05319105e","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"b35ae977bc51cf5fda246fff772351a05319105e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1518024831019.tgz","fileCount":44,"unpackedSize":259455},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.0.0-next.1518024831019_1518024843907_0.44140951408968077"},"_hasShrinkwrap":false},"1.0.0-next.1518042185396":{"name":"puppeteer","version":"1.0.0-next.1518042185396","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"cde6d6c4d0744e78a9ff25d015cc1693b10464fd","readme":"# Puppeteer \n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n```\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~71Mb Mac, ~90Mb Linux, ~110Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description\nof the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n1. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n1. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n \n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n\n1. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these\nother frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1518042185396","_shasum":"6e7b048de6c840fc1460f03363880474c72c063f","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"6e7b048de6c840fc1460f03363880474c72c063f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1518042185396.tgz","fileCount":44,"unpackedSize":259455},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.0.0-next.1518042185396_1518042199652_0.9798424467683364"},"_hasShrinkwrap":false},"1.0.0-next.1518044651367":{"name":"puppeteer","version":"1.0.0-next.1518044651367","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"18a1fb9385fdf3eed3cdb6af657313326cf427b6","readme":"# Puppeteer \n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n```\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description\nof the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n1. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n1. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n \n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n\n1. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these\nother frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1518044651367","_shasum":"91c88e498822563b51afb2822a43c2f86906ca5b","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"91c88e498822563b51afb2822a43c2f86906ca5b","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1518044651367.tgz","fileCount":44,"unpackedSize":259457},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.0.0-next.1518044651367_1518044665228_0.7811178969523997"},"_hasShrinkwrap":false},"1.0.0-next.1518069662486":{"name":"puppeteer","version":"1.0.0-next.1518069662486","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"070243e4b6cc4e425f2c0674df89903452d1a7cf","readme":"# Puppeteer \n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n```\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description\nof the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n1. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n1. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n \n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n\n1. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these\nother frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1518069662486","_shasum":"f0350da9b9a098abcc0b175f49685cf55524fba0","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"f0350da9b9a098abcc0b175f49685cf55524fba0","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1518069662486.tgz","fileCount":44,"unpackedSize":260160},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.0.0-next.1518069662486_1518069673400_0.20194632108593624"},"_hasShrinkwrap":false},"1.0.0-next.1518069677340":{"name":"puppeteer","version":"1.0.0-next.1518069677340","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"ac1b9a0eb0d0560fe094c6094324753109a891bd","readme":"# Puppeteer \n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n```\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description\nof the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n1. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n1. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n \n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n\n1. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these\nother frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1518069677340","_shasum":"23f9b529e09940228d29278151743827dc8a0dad","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"23f9b529e09940228d29278151743827dc8a0dad","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1518069677340.tgz","fileCount":44,"unpackedSize":259655},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.0.0-next.1518069677340_1518069689518_0.36305021883400124"},"_hasShrinkwrap":false},"1.0.0-next.1518148905595":{"name":"puppeteer","version":"1.0.0-next.1518148905595","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"b275e66594318ad1fb1ba9f0723b221d40967756","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1518148905595","_shasum":"b2450fbc2dfc51509fa1a4baaa4bb2af4f6cd6a9","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"b2450fbc2dfc51509fa1a4baaa4bb2af4f6cd6a9","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1518148905595.tgz","fileCount":44,"unpackedSize":260344},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.0.0-next.1518148905595_1518148916250_0.9975779303056866"},"_hasShrinkwrap":false},"1.0.0-next.1518485242743":{"name":"puppeteer","version":"1.0.0-next.1518485242743","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"f3ba4362392f1d5c8da529f18f2646e61d754f86","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1518485242743","_shasum":"9976a5112c6557ee2bbbc24872bc05053b07c07b","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"9976a5112c6557ee2bbbc24872bc05053b07c07b","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1518485242743.tgz","fileCount":44,"unpackedSize":260345},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.0.0-next.1518485242743_1518485253029_0.7285528241302417"},"_hasShrinkwrap":false},"1.0.0-next.1518548577113":{"name":"puppeteer","version":"1.0.0-next.1518548577113","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"700244a29ab2684a96a83ddce9545a238a5e4645","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1518548577113","_shasum":"73e58193164e1aa9805c71ede0978128c445e6a1","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"73e58193164e1aa9805c71ede0978128c445e6a1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1518548577113.tgz","fileCount":44,"unpackedSize":260345},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.0.0-next.1518548577113_1518548592735_0.9274844988235234"},"_hasShrinkwrap":false},"1.0.0-next.1518550112236":{"name":"puppeteer","version":"1.0.0-next.1518550112236","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"856c431914f361ab49bef588158370dad7f2f06f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1518550112236","_shasum":"97afeecaba1e8fc10fdb1476415cacfdc5672ed2","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"97afeecaba1e8fc10fdb1476415cacfdc5672ed2","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1518550112236.tgz","fileCount":44,"unpackedSize":261690},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.0.0-next.1518550112236_1518550124865_0.09593547948572145"},"_hasShrinkwrap":false},"1.0.0-next.1518558601182":{"name":"puppeteer","version":"1.0.0-next.1518558601182","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"885c93a927418889a017d11202ac5cf9b279cec2","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1518558601182","_shasum":"b2e6b1deecefb508eb368aec469ccb05b01af227","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"b2e6b1deecefb508eb368aec469ccb05b01af227","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1518558601182.tgz","fileCount":44,"unpackedSize":261690},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.0.0-next.1518558601182_1518558615305_0.9528942484486114"},"_hasShrinkwrap":false},"1.0.0-next.1518559525177":{"name":"puppeteer","version":"1.0.0-next.1518559525177","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"ae22ef30b38673d1d09fb7cf2f7b7bffd3517f5a","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1518559525177","_shasum":"77fd92f7636baf616753508ea8ec90c3e8b2a3c4","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"77fd92f7636baf616753508ea8ec90c3e8b2a3c4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1518559525177.tgz","fileCount":44,"unpackedSize":261694},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.0.0-next.1518559525177_1518559540332_0.3041656751993389"},"_hasShrinkwrap":false},"1.0.0-next.1518561730306":{"name":"puppeteer","version":"1.0.0-next.1518561730306","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"533271"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"ee5ec3e6303889b5d5fba97d58fa16d81b48b127","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1518561730306","_shasum":"b52fd183cdb194d86183d033c8bbb079ea2fe1eb","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"b52fd183cdb194d86183d033c8bbb079ea2fe1eb","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1518561730306.tgz","fileCount":44,"unpackedSize":261694},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.0.0-next.1518561730306_1518561745479_0.779918957363448"},"_hasShrinkwrap":false},"1.0.0-next.1518570822451":{"name":"puppeteer","version":"1.0.0-next.1518570822451","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"536395"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"4a53bca6b081643855e005c940d8cbc52404e99e","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1518570822451","_shasum":"75c3b23ac666f54518c52071d00f395fc873f361","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"75c3b23ac666f54518c52071d00f395fc873f361","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1518570822451.tgz","fileCount":44,"unpackedSize":261694},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.0.0-next.1518570822451_1518570833269_0.47802047591195085"},"_hasShrinkwrap":false},"1.0.0-next.1518653466440":{"name":"puppeteer","version":"1.0.0-next.1518653466440","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"536395"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"43c0feb2f21a7d14a93dff08d0165f5635c094f1","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1518653466440","_shasum":"fcd8de6255507613e7e3d36101cbee1d0e0b92e9","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"fcd8de6255507613e7e3d36101cbee1d0e0b92e9","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1518653466440.tgz","fileCount":44,"unpackedSize":261860},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.0.0-next.1518653466440_1518653482511_0.7360736763762168"},"_hasShrinkwrap":false},"1.0.0-next.1518655197185":{"name":"puppeteer","version":"1.0.0-next.1518655197185","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"536395"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"3656cc227f3127ef588cde3bcbbde031cfb41030","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1518655197185","_shasum":"9b92924247ab289e85b6db3589f797ed59ae009d","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"9b92924247ab289e85b6db3589f797ed59ae009d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1518655197185.tgz","fileCount":44,"unpackedSize":261860},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.0.0-next.1518655197185_1518655210533_0.03953394977569746"},"_hasShrinkwrap":false},"1.0.0-next.1518659629421":{"name":"puppeteer","version":"1.0.0-next.1518659629421","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"536395"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"e8a085ccfb478d51cd45172dbc7f4d1311c75ec8","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1518659629421","_shasum":"91ce0a16105f16237153a46738b8e922b22bf33c","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"91ce0a16105f16237153a46738b8e922b22bf33c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1518659629421.tgz","fileCount":45,"unpackedSize":264822},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.0.0-next.1518659629421_1518659642363_0.7744193244826834"},"_hasShrinkwrap":false},"1.0.0-next.1518730236759":{"name":"puppeteer","version":"1.0.0-next.1518730236759","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"536395"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"fc94f98247c22d61d9f6fb7e1c348af901d077b4","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.0.0-next.1518730236759","_shasum":"27e567df53e10ad68008b10ae925b04f4f22d4a1","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"27e567df53e10ad68008b10ae925b04f4f22d4a1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.0.0-next.1518730236759.tgz","fileCount":45,"unpackedSize":264854},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.0.0-next.1518730236759_1518730247054_0.9464611187032237"},"_hasShrinkwrap":false},"1.1.0":{"name":"puppeteer","version":"1.1.0","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"536395"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"fecbbac6314598b62426edb885ac41d606ae6b3e","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.1.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-Up+EiDVtc+EueFUzEFi4JqTlkXdC4pjMng0W9s/uqg2HP7+EHJiIe8OtwP7I+Jk7rI1kS5WIVpqx46aihnLuJQ==","shasum":"97fbc2fbbf9ab659e7e202a68ac1ba54b8bc0a25","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.0.tgz","fileCount":66,"unpackedSize":542383},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.0_1518801500151_0.04392302930358838"},"_hasShrinkwrap":false},"1.1.0-next.1518809287189":{"name":"puppeteer","version":"1.1.0-next.1518809287189","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"536395"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"85081805ea1b2dbd01618bc84cb7b82c976784d3","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.0-next.1518809287189","_shasum":"d304f37635bfd9a844377b85f8ed651c05099028","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"d304f37635bfd9a844377b85f8ed651c05099028","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.0-next.1518809287189.tgz","fileCount":45,"unpackedSize":264854},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.0-next.1518809287189_1518809300974_0.724561577745527"},"_hasShrinkwrap":false},"1.1.0-next.1519262100584":{"name":"puppeteer","version":"1.1.0-next.1519262100584","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"536395"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"090590a950126d12a331ddde45c1ea6bd79f8b77","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.0-next.1519262100584","_shasum":"608aa7ff9c9a0c87b5f0479ac9cfd34a03d3b1d8","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"608aa7ff9c9a0c87b5f0479ac9cfd34a03d3b1d8","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.0-next.1519262100584.tgz","fileCount":45,"unpackedSize":265018},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.0-next.1519262100584_1519262113743_0.05463884983801437"},"_hasShrinkwrap":false},"1.1.0-next.1519266285104":{"name":"puppeteer","version":"1.1.0-next.1519266285104","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"28f88e8ef907a3216c13dc8deb7e042bd350ce10","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.0-next.1519266285104","_shasum":"9f05866e833e2dc5593426f185476c51cb24f3b3","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"9f05866e833e2dc5593426f185476c51cb24f3b3","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.0-next.1519266285104.tgz","fileCount":45,"unpackedSize":265018},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.0-next.1519266285104_1519266300771_0.7447239439965154"},"_hasShrinkwrap":false},"1.1.0-next.1519345518390":{"name":"puppeteer","version":"1.1.0-next.1519345518390","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"80078d9526528c0ee7ed745b75595c7274a907f4","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Scrape content from websites.\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.0-next.1519345518390","_shasum":"288a641b817b15974aeddbcb1280795b711a3896","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"288a641b817b15974aeddbcb1280795b711a3896","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.0-next.1519345518390.tgz","fileCount":45,"unpackedSize":265158},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.0-next.1519345518390_1519345528905_0.5707116980460825"},"_hasShrinkwrap":false},"1.1.0-next.1519350670048":{"name":"puppeteer","version":"1.1.0-next.1519350670048","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"ee7ebd6e17f972d2e0d4661f335421145c4188da","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.0-next.1519350670048","_shasum":"6036f8ce166a42bada8b0c12bdab53bc11f360a4","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"6036f8ce166a42bada8b0c12bdab53bc11f360a4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.0-next.1519350670048.tgz","fileCount":45,"unpackedSize":265126},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.0-next.1519350670048_1519350680374_0.023645295617354956"},"_hasShrinkwrap":false},"1.1.0-next.1519355295259":{"name":"puppeteer","version":"1.1.0-next.1519355295259","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"66887743ead54405e2e8b5865462b87e76e8e5cf","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.0-next.1519355295259","_shasum":"85cea7f17365989ad6c9e2330e0e568041a2f45a","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"85cea7f17365989ad6c9e2330e0e568041a2f45a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.0-next.1519355295259.tgz","fileCount":45,"unpackedSize":265203},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.0-next.1519355295259_1519355307781_0.83893469018458"},"_hasShrinkwrap":false},"1.1.0-next.1519355543971":{"name":"puppeteer","version":"1.1.0-next.1519355543971","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"fc2a10440f7c54a745566f7b240d51a0faffb698","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.0-next.1519355543971","_shasum":"56163b9ae41dc8a34110cb015d1fa88e54646cdb","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"56163b9ae41dc8a34110cb015d1fa88e54646cdb","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.0-next.1519355543971.tgz","fileCount":45,"unpackedSize":265308},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.0-next.1519355543971_1519355555567_0.5640126149823037"},"_hasShrinkwrap":false},"1.1.0-next.1519424108630":{"name":"puppeteer","version":"1.1.0-next.1519424108630","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"56a475f86bba60466299e05cf95ccf14b74fafd9","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.0-next.1519424108630","_shasum":"e30f35b5abd942e616b91488c43dec47f23c477d","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"e30f35b5abd942e616b91488c43dec47f23c477d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.0-next.1519424108630.tgz","fileCount":45,"unpackedSize":266485},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.0-next.1519424108630_1519424120032_0.4805144498517082"},"_hasShrinkwrap":false},"1.1.0-next.1519430203926":{"name":"puppeteer","version":"1.1.0-next.1519430203926","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"e2b96df4d73383bdcd46ee2e60b0e08ee965b0a5","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.0-next.1519430203926","_shasum":"6bdf102a55ebf45a28a3c45cb956301b3f7a624d","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"6bdf102a55ebf45a28a3c45cb956301b3f7a624d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.0-next.1519430203926.tgz","fileCount":45,"unpackedSize":266485},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.0-next.1519430203926_1519430216763_0.6833953830605466"},"_hasShrinkwrap":false},"1.1.0-next.1519449884398":{"name":"puppeteer","version":"1.1.0-next.1519449884398","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"223b59254c55446a1be310d660c1df40ad88cb5f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.0-next.1519449884398","_shasum":"9b83f59b54b2da2f5477dfc2340e843f91981bf7","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"9b83f59b54b2da2f5477dfc2340e843f91981bf7","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.0-next.1519449884398.tgz","fileCount":45,"unpackedSize":266928},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.0-next.1519449884398_1519449895569_0.36879184500904927"},"_hasShrinkwrap":false},"1.1.1-next.1519451217463":{"name":"puppeteer","version":"1.1.1-next.1519451217463","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"3c6ed67c2e8b4e02cdd71ca6fd72a73a786cc9e1","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.1-next.1519451217463","_shasum":"631ecc4d6d69a55f1f3b3b6f0669aad3a9d7f707","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"631ecc4d6d69a55f1f3b3b6f0669aad3a9d7f707","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.1-next.1519451217463.tgz","fileCount":45,"unpackedSize":266928},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.1-next.1519451217463_1519451228049_0.2514744717180184"},"_hasShrinkwrap":false},"1.1.1":{"name":"puppeteer","version":"1.1.1","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"536395"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"42b0082813a420d0d32aa58fcdaddefd9151fad7","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.1","_shasum":"adbf25e49f5ef03443c10ab8e09a954ca0c7bfee","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.4.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"adbf25e49f5ef03443c10ab8e09a954ca0c7bfee","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.1.tgz","fileCount":67,"unpackedSize":542756},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.1_1519452546692_0.20404394191284592"},"_hasShrinkwrap":false},"1.1.1-next.1519455879191":{"name":"puppeteer","version":"1.1.1-next.1519455879191","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"2a84f9f343e1e4213ced29cde818e6281e9fb7b5","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.1-next.1519455879191","_shasum":"159a19b0b262c5b97c75ea853d5e3882d218a4a4","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"159a19b0b262c5b97c75ea853d5e3882d218a4a4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.1-next.1519455879191.tgz","fileCount":45,"unpackedSize":266928},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.1-next.1519455879191_1519455892025_0.788429232535464"},"_hasShrinkwrap":false},"1.1.1-next.1519675964105":{"name":"puppeteer","version":"1.1.1-next.1519675964105","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"ffe5b63dbade012744f6a91a6f9a89b3615d5246","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.1-next.1519675964105","_shasum":"763e22bdcc59c2bb140d64cc6aebd9cfb011217a","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"763e22bdcc59c2bb140d64cc6aebd9cfb011217a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.1-next.1519675964105.tgz","fileCount":47,"unpackedSize":267560},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.1-next.1519675964105_1519675975595_0.3959558283680007"},"_hasShrinkwrap":false},"1.1.1-next.1520401889860":{"name":"puppeteer","version":"1.1.1-next.1520401889860","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"edc510c1524da823801cd798f59a2c0fc6b06ff7","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.1-next.1520401889860","_shasum":"4a9c632a5d6df978856bc1946ceb891ae0bd04d3","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"4a9c632a5d6df978856bc1946ceb891ae0bd04d3","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.1-next.1520401889860.tgz","fileCount":47,"unpackedSize":267734},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.1-next.1520401889860_1520401901818_0.018451750749024276"},"_hasShrinkwrap":false},"1.1.1-next.1520401938885":{"name":"puppeteer","version":"1.1.1-next.1520401938885","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"44d8000de12f2919ec5b0e5979b7b0739ba961f7","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.1-next.1520401938885","_shasum":"e0b8b503afb21cc8442d1dbc8f86d82dcdcbccce","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"e0b8b503afb21cc8442d1dbc8f86d82dcdcbccce","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.1-next.1520401938885.tgz","fileCount":47,"unpackedSize":268020},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.1-next.1520401938885_1520401950222_0.6050926630820626"},"_hasShrinkwrap":false},"1.1.1-next.1520415469395":{"name":"puppeteer","version":"1.1.1-next.1520415469395","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"cad71d9bd932e84e92a9f7d874c51d590c490b36","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.1-next.1520415469395","_shasum":"8d3f4b6e27b210a9604a89104cabd07d5b23533d","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"8d3f4b6e27b210a9604a89104cabd07d5b23533d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.1-next.1520415469395.tgz","fileCount":47,"unpackedSize":267982},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.1-next.1520415469395_1520415482021_0.9436685200845465"},"_hasShrinkwrap":false},"1.1.1-next.1520879814994":{"name":"puppeteer","version":"1.1.1-next.1520879814994","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"826fe42c48fe0a5fb49c62f1b87387638a6635c8","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.1-next.1520879814994","_shasum":"449b467f8d9e75efabd2f1228f00b95d6d8febd3","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"449b467f8d9e75efabd2f1228f00b95d6d8febd3","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.1-next.1520879814994.tgz","fileCount":47,"unpackedSize":268300},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.1-next.1520879814994_1520879826234_0.7187822845761105"},"_hasShrinkwrap":false},"1.1.1-next.1520894418677":{"name":"puppeteer","version":"1.1.1-next.1520894418677","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"52d3bc05dea670e087afced923e288e4633c09b2","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.1-next.1520894418677","_shasum":"7b53eb6583b5e2ce17d9dd4538ab6f84cd3345fb","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"7b53eb6583b5e2ce17d9dd4538ab6f84cd3345fb","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.1-next.1520894418677.tgz","fileCount":47,"unpackedSize":268315},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.1-next.1520894418677_1520894430043_0.7860483209701408"},"_hasShrinkwrap":false},"1.1.1-next.1520952323905":{"name":"puppeteer","version":"1.1.1-next.1520952323905","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"5af70e8ce339cefedf2f1eb2ab75960ef2ddefcf","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.1-next.1520952323905","_shasum":"645202e759542afd4f0b2744088e5d8dca192a28","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"645202e759542afd4f0b2744088e5d8dca192a28","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.1-next.1520952323905.tgz","fileCount":47,"unpackedSize":268315},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.1-next.1520952323905_1520952336896_0.2209188430351534"},"_hasShrinkwrap":false},"1.1.1-next.1520952444105":{"name":"puppeteer","version":"1.1.1-next.1520952444105","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"fc7e4d1065f95b02202185a434e679f29a486600","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.1-next.1520952444105","_shasum":"0fbc96c50b9ef7d521181eef5c8ed176413831d4","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"0fbc96c50b9ef7d521181eef5c8ed176413831d4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.1-next.1520952444105.tgz","fileCount":47,"unpackedSize":268315},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.1-next.1520952444105_1520952460391_0.6157000663587171"},"_hasShrinkwrap":false},"1.1.1-next.1520953767679":{"name":"puppeteer","version":"1.1.1-next.1520953767679","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"554bd59588a127980b524fd49c27ab7da17c1162","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.1-next.1520953767679","_shasum":"67fabd88cb6ab9af8bb8477cfe740f1ea845deee","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"67fabd88cb6ab9af8bb8477cfe740f1ea845deee","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.1-next.1520953767679.tgz","fileCount":52,"unpackedSize":271643},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.1-next.1520953767679_1520953786773_0.07468585002933192"},"_hasShrinkwrap":false},"1.1.1-next.1520958529908":{"name":"puppeteer","version":"1.1.1-next.1520958529908","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"552be1ae871f7e6e7de2559ceed58d759ae2668c","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.1-next.1520958529908","_shasum":"ecffc75a76da5841817ae349fca5ce6d738ea108","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"ecffc75a76da5841817ae349fca5ce6d738ea108","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.1-next.1520958529908.tgz","fileCount":52,"unpackedSize":271643},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.1-next.1520958529908_1520958545784_0.3149565155845251"},"_hasShrinkwrap":false},"1.1.1-next.1521058223243":{"name":"puppeteer","version":"1.1.1-next.1521058223243","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"625c7ebdda2ef0473ee8d593dd30a1d34d3ee54a","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.1-next.1521058223243","_shasum":"7d2ea337783b9e5e86003e685454195bc3114456","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"7d2ea337783b9e5e86003e685454195bc3114456","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.1-next.1521058223243.tgz","fileCount":52,"unpackedSize":271804},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.1-next.1521058223243_1521058238878_0.25340340103784054"},"_hasShrinkwrap":false},"1.1.1-next.1521075426851":{"name":"puppeteer","version":"1.1.1-next.1521075426851","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"4b7fbf8ee0400b6d8be1e0ddda0a08899655d8bf","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.1-next.1521075426851","_shasum":"e981428b1b97616913b2b92051964bff7c475f66","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"e981428b1b97616913b2b92051964bff7c475f66","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.1-next.1521075426851.tgz","fileCount":52,"unpackedSize":271804},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.1-next.1521075426851_1521075439374_0.6896815660007936"},"_hasShrinkwrap":false},"1.1.1-next.1521139956274":{"name":"puppeteer","version":"1.1.1-next.1521139956274","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"c082a82547fc309628c74c3f433c2b4dc873edc3","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.1-next.1521139956274","_shasum":"ef9c87d67c13670877cffb54854fb008e04a915b","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"ef9c87d67c13670877cffb54854fb008e04a915b","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.1-next.1521139956274.tgz","fileCount":52,"unpackedSize":272116},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.1-next.1521139956274_1521139973849_0.9459621475391509"},"_hasShrinkwrap":false},"1.1.1-next.1521148059100":{"name":"puppeteer","version":"1.1.1-next.1521148059100","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"7d387d8d75b2244cdb64f1258faf0868470aa671","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.1-next.1521148059100","_shasum":"f18bd34e2da2558b98c3adf29ab14e3b84edc39f","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"f18bd34e2da2558b98c3adf29ab14e3b84edc39f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.1-next.1521148059100.tgz","fileCount":52,"unpackedSize":272115},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.1-next.1521148059100_1521148075059_0.7949197696655699"},"_hasShrinkwrap":false},"1.1.1-next.1521151010194":{"name":"puppeteer","version":"1.1.1-next.1521151010194","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"538022"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"d79eb70267a6c05053bd8c31159810019945fe68","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.1-next.1521151010194","_shasum":"ac79b4334bd06e234ff47534d09b667c197e65df","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"ac79b4334bd06e234ff47534d09b667c197e65df","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.1-next.1521151010194.tgz","fileCount":52,"unpackedSize":272115},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.1-next.1521151010194_1521151024764_0.8905155057961613"},"_hasShrinkwrap":false},"1.1.1-next.1521163270821":{"name":"puppeteer","version":"1.1.1-next.1521163270821","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"543305"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"4e1f2e2eb2c2473f7ceafabeea31d78a642b0b36","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.1.1-next.1521163270821","_shasum":"1d1da2917b5af395536a5daedfd5d67f8b426401","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"1d1da2917b5af395536a5daedfd5d67f8b426401","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.1.1-next.1521163270821.tgz","fileCount":52,"unpackedSize":272681},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.1.1-next.1521163270821_1521163285237_0.6238906752718882"},"_hasShrinkwrap":false},"1.2.0-next.1521166881791":{"name":"puppeteer","version":"1.2.0-next.1521166881791","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"543305"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"f2fae9f35a9169f5a4833f5b063534d399b75e3a","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1521166881791","_shasum":"63a2d68b7dd1fce66f799caf23692264d5f9b739","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"63a2d68b7dd1fce66f799caf23692264d5f9b739","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1521166881791.tgz","fileCount":52,"unpackedSize":272681},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1521166881791_1521166896032_0.197364731578348"},"_hasShrinkwrap":false},"1.2.0":{"name":"puppeteer","version":"1.2.0","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"543305"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"f2fae9f35a9169f5a4833f5b063534d399b75e3a","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.2.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-4sY/6mB7+kNPGAzPGKq65tH0VG3ohUEkXHuOReB9K/tw3m1TqifYmxnMR/uDeci/UPwyk5K1gWYh8rw0U0Zscw==","shasum":"6a8a1c618af073dfcf6fc7c7e3c12e54129ffa98","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0.tgz","fileCount":71,"unpackedSize":552875},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0_1521166954358_0.37223562551251943"},"_hasShrinkwrap":false},"1.2.0-next.1521223510564":{"name":"puppeteer","version":"1.2.0-next.1521223510564","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"543305"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"311f3071532a78f856ffe9d3af012a809cfe611f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1521223510564","_shasum":"908a7bac6e1dc80b4b5bb28dc48cf011904ff242","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"908a7bac6e1dc80b4b5bb28dc48cf011904ff242","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1521223510564.tgz","fileCount":52,"unpackedSize":272681},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1521223510564_1521223529311_0.021341443178746422"},"_hasShrinkwrap":false},"1.2.0-next.1521239766470":{"name":"puppeteer","version":"1.2.0-next.1521239766470","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"543305"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"38c6873fbbc469fe422977131bf2da8e75ec9228","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1521239766470","_shasum":"49d1cb95c36e306f8028e9e618b48a662bd04cb6","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"49d1cb95c36e306f8028e9e618b48a662bd04cb6","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1521239766470.tgz","fileCount":52,"unpackedSize":272681},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1521239766470_1521239785897_0.858105926834513"},"_hasShrinkwrap":false},"1.2.0-next.1521514943168":{"name":"puppeteer","version":"1.2.0-next.1521514943168","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"543305"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"47481967c5344dc0ca17ebaf4bd3d9650da771d0","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1521514943168","_shasum":"731f73bf021092328b184d5239bc9b3ed15f03e1","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"731f73bf021092328b184d5239bc9b3ed15f03e1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1521514943168.tgz","fileCount":52,"unpackedSize":272681},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1521514943168_1521514956148_0.43619195638252206"},"_hasShrinkwrap":false},"1.2.0-next.1522268068681":{"name":"puppeteer","version":"1.2.0-next.1522268068681","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"543305"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"d46e157f19ecce1622cabfc25b2c859a6d37ce4f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1522268068681","_shasum":"c9648fd38a4807d34701522a598217969a0ad3f4","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"c9648fd38a4807d34701522a598217969a0ad3f4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1522268068681.tgz","fileCount":52,"unpackedSize":272776},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1522268068681_1522268084700_0.36346946078140774"},"_hasShrinkwrap":false},"1.2.0-next.1522268477499":{"name":"puppeteer","version":"1.2.0-next.1522268477499","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"543305"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"^2.6.0-rc"},"gitHead":"9af02a0d8615ce77fb5aff2bf748e2a76aae6488","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1522268477499","_shasum":"b3d15bffa8145714b720ca6dfe534727b2eb2226","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"b3d15bffa8145714b720ca6dfe534727b2eb2226","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1522268477499.tgz","fileCount":52,"unpackedSize":272776},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1522268477499_1522268489781_0.20715346423328374"},"_hasShrinkwrap":false},"1.2.0-next.1522280204510":{"name":"puppeteer","version":"1.2.0-next.1522280204510","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"543305"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.7.0"},"gitHead":"abb05e069ddb70d5a79ff7b7623ebd96666ea280","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1522280204510","_shasum":"71144a5d39eea37eee96e09bdb75f1ddab003061","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"71144a5d39eea37eee96e09bdb75f1ddab003061","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1522280204510.tgz","fileCount":52,"unpackedSize":272792},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1522280204510_1522280216703_0.238633210405242"},"_hasShrinkwrap":false},"1.2.0-next.1522345485546":{"name":"puppeteer","version":"1.2.0-next.1522345485546","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"543305"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.7.0"},"gitHead":"ebe17371b0dc84760a5685e510f14182b73a1c77","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1522345485546","_shasum":"4ca73f3e7be0b62ec5015dcf1695c2eb261c93ac","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"4ca73f3e7be0b62ec5015dcf1695c2eb261c93ac","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1522345485546.tgz","fileCount":52,"unpackedSize":272792},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1522345485546_1522345499378_0.7607250397352059"},"_hasShrinkwrap":false},"1.2.0-next.1522345707169":{"name":"puppeteer","version":"1.2.0-next.1522345707169","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"543305"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.7.0"},"gitHead":"506103556b3dc48ddadb92d7dcfecdd37f3c139b","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1522345707169","_shasum":"77b5c42d7e0ccbf9d0f52fa0c4134b62cfaaa1a6","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"77b5c42d7e0ccbf9d0f52fa0c4134b62cfaaa1a6","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1522345707169.tgz","fileCount":52,"unpackedSize":272835},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1522345707169_1522345719547_0.6103896769068142"},"_hasShrinkwrap":false},"1.2.0-next.1522346209003":{"name":"puppeteer","version":"1.2.0-next.1522346209003","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"543305"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.7.0"},"gitHead":"d4f24f1ec548b31c6dad937180f07e0dcb4c4cc9","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1522346209003","_shasum":"7448d1fd926a5293fbf349de56a73e0c21762bb6","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"7448d1fd926a5293fbf349de56a73e0c21762bb6","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1522346209003.tgz","fileCount":52,"unpackedSize":273178},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1522346209003_1522346222297_0.9875237917907664"},"_hasShrinkwrap":false},"1.2.0-next.1522357005652":{"name":"puppeteer","version":"1.2.0-next.1522357005652","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"543305"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.7.0"},"gitHead":"41d583829740c204dbb9c1df43cb91db9dc6f566","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1522357005652","_shasum":"3a9c3020eb55976fad7c9aaf03b4e972be86f82a","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"3a9c3020eb55976fad7c9aaf03b4e972be86f82a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1522357005652.tgz","fileCount":52,"unpackedSize":274004},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1522357005652_1522357017326_0.6031227215363728"},"_hasShrinkwrap":false},"1.2.0-next.1522358202204":{"name":"puppeteer","version":"1.2.0-next.1522358202204","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"546920"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.7.0"},"gitHead":"c6c60aa1cb2f39e02f7af2b89f4295ececc6b98b","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1522358202204","_shasum":"92b2e276560988c39c4e072997f4c7ca3ea9758d","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"92b2e276560988c39c4e072997f4c7ca3ea9758d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1522358202204.tgz","fileCount":52,"unpackedSize":274004},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1522358202204_1522358214673_0.2874957843022361"},"_hasShrinkwrap":false},"1.2.0-next.1522369666407":{"name":"puppeteer","version":"1.2.0-next.1522369666407","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"546920"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.7.0"},"gitHead":"c4da19bd23d5cdf8d568b60f8c16dc06c3448587","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1522369666407","_shasum":"f3d8b3677f278e012c16d8c78f3ec196ea457fdc","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"f3d8b3677f278e012c16d8c78f3ec196ea457fdc","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1522369666407.tgz","fileCount":52,"unpackedSize":274004},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1522369666407_1522369677203_0.05346490242881585"},"_hasShrinkwrap":false},"1.2.0-next.1522432314513":{"name":"puppeteer","version":"1.2.0-next.1522432314513","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"546920"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.7.0"},"gitHead":"8b0fd0ae4ac955fb19d71bddcaffb5dba7ce97a3","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1522432314513","_shasum":"5f0cdc6a41d4c7ed3fcfa5a24e7184eb6d98f515","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"5f0cdc6a41d4c7ed3fcfa5a24e7184eb6d98f515","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1522432314513.tgz","fileCount":52,"unpackedSize":274061},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1522432314513_1522432327980_0.3120213944422736"},"_hasShrinkwrap":false},"1.2.0-next.1522438832236":{"name":"puppeteer","version":"1.2.0-next.1522438832236","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"546920"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.7.0"},"gitHead":"dde45faaebd4232ef953622a8e1e07e544cf64a8","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i --save puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1522438832236","_shasum":"010603227b88be7c269d76fadab7d9052d8422e7","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"010603227b88be7c269d76fadab7d9052d8422e7","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1522438832236.tgz","fileCount":52,"unpackedSize":274218},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1522438832236_1522438846165_0.4596709835105084"},"_hasShrinkwrap":false},"1.2.0-next.1522776506144":{"name":"puppeteer","version":"1.2.0-next.1522776506144","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"546920"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.7.0"},"gitHead":"f51a315911e3f9f28b238662630416c49a079a02","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1522776506144","_shasum":"a178ba501b31fda18ed4b1df9c380316b31d429b","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"a178ba501b31fda18ed4b1df9c380316b31d429b","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1522776506144.tgz","fileCount":52,"unpackedSize":274211},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1522776506144_1522776517837_0.8347171693250854"},"_hasShrinkwrap":false},"1.2.0-next.1522793255797":{"name":"puppeteer","version":"1.2.0-next.1522793255797","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"546920"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.7.0"},"gitHead":"94c32e4bc8aedfef48c7ac12cd476bf5524346d7","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1522793255797","_shasum":"c80228caba178efe95adcd38c935791f7adbf16b","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"c80228caba178efe95adcd38c935791f7adbf16b","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1522793255797.tgz","fileCount":52,"unpackedSize":275282},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1522793255797_1522793266888_0.7177845426376825"},"_hasShrinkwrap":false},"1.2.0-next.1522794237544":{"name":"puppeteer","version":"1.2.0-next.1522794237544","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"546920"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.7.0"},"gitHead":"f925158733109dc547a95ee314b1c8780b40943e","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1522794237544","_shasum":"0366b46b5e6b5fd7d18108b20721010b7d69508a","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"0366b46b5e6b5fd7d18108b20721010b7d69508a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1522794237544.tgz","fileCount":52,"unpackedSize":275282},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1522794237544_1522794250597_0.747168360021266"},"_hasShrinkwrap":false},"1.2.0-next.1522875517748":{"name":"puppeteer","version":"1.2.0-next.1522875517748","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"548153"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.7.0"},"gitHead":"98093f0763e08e6bcaf56094fbd5eb12b562d792","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1522875517748","_shasum":"01993a1e73532af9d47d299f41e48db4d752b9ee","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"01993a1e73532af9d47d299f41e48db4d752b9ee","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1522875517748.tgz","fileCount":52,"unpackedSize":275282},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1522875517748_1522875532653_0.37207143558256517"},"_hasShrinkwrap":false},"1.2.0-next.1522875925576":{"name":"puppeteer","version":"1.2.0-next.1522875925576","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"548153"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.7.0"},"gitHead":"3b88d0d7c9dd23b52292476c549cd82ab39b5348","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1522875925576","_shasum":"283821a21e470da5a16f179bf0356880fcee52f8","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"283821a21e470da5a16f179bf0356880fcee52f8","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1522875925576.tgz","fileCount":52,"unpackedSize":275417},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1522875925576_1522875937755_0.7684799167624903"},"_hasShrinkwrap":false},"1.2.0-next.1522876116282":{"name":"puppeteer","version":"1.2.0-next.1522876116282","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"548153"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"23706188192ce1f616ae29b50010eb560ca29da9","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1522876116282","_shasum":"c1a8b6f722b7e0a8aa391153a39a711dd28ceec4","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"c1a8b6f722b7e0a8aa391153a39a711dd28ceec4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1522876116282.tgz","fileCount":52,"unpackedSize":275602},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1522876116282_1522876128502_0.41567068165690135"},"_hasShrinkwrap":false},"1.2.0-next.1522959058052":{"name":"puppeteer","version":"1.2.0-next.1522959058052","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"548153"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"1fdd33886fc012e9550e09ed2bcdc306f9b758e7","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1522959058052","_shasum":"9db9429b46a0ec819a834bd69054baacf406bb92","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"9db9429b46a0ec819a834bd69054baacf406bb92","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1522959058052.tgz","fileCount":52,"unpackedSize":275602},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1522959058052_1522959070629_0.03463783362912687"},"_hasShrinkwrap":false},"1.2.0-next.1522996977258":{"name":"puppeteer","version":"1.2.0-next.1522996977258","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"548153"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"4663b43a622e921f9f459552f308f9418754486d","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1522996977258","_shasum":"aa658809c421b1e928cd3b5bc83fd557787b28de","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"aa658809c421b1e928cd3b5bc83fd557787b28de","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1522996977258.tgz","fileCount":52,"unpackedSize":275602},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1522996977258_1522996995207_0.5633656352632497"},"_hasShrinkwrap":false},"1.2.0-next.1523056452461":{"name":"puppeteer","version":"1.2.0-next.1523056452461","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"548921"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"dfcee2e6311706a5719e47d2edbe22b4e8121b69","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523056452461","_shasum":"c37b441bad6ea49c374ba4316f2c83cd90d59c93","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"c37b441bad6ea49c374ba4316f2c83cd90d59c93","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523056452461.tgz","fileCount":52,"unpackedSize":275919},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523056452461_1523056466518_0.4833627956687596"},"_hasShrinkwrap":false},"1.2.0-next.1523057899376":{"name":"puppeteer","version":"1.2.0-next.1523057899376","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"548921"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"35e34db19863caf9d38cbaf0fd801b22cd078a0a","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523057899376","_shasum":"5fed03075b987c514f15aeed1e4b34acf0439e24","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"5fed03075b987c514f15aeed1e4b34acf0439e24","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523057899376.tgz","fileCount":52,"unpackedSize":276061},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523057899376_1523057912785_0.47366111595993"},"_hasShrinkwrap":false},"1.2.0-next.1523064178622":{"name":"puppeteer","version":"1.2.0-next.1523064178622","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"548921"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"8c54f41552b7352032120c95240f18f7191b3b19","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523064178622","_shasum":"b34fb1483c229ca0f94230896c3e6b551d67a48b","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"b34fb1483c229ca0f94230896c3e6b551d67a48b","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523064178622.tgz","fileCount":51,"unpackedSize":274336},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523064178622_1523064189700_0.9217317183465481"},"_hasShrinkwrap":false},"1.2.0-next.1523088162996":{"name":"puppeteer","version":"1.2.0-next.1523088162996","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"45d97e572aff1541a8dbf50f41ee88391f1a87ca","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523088162996","_shasum":"8b8bf528e85982b935f445fddb213089c8888073","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"8b8bf528e85982b935f445fddb213089c8888073","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523088162996.tgz","fileCount":51,"unpackedSize":274336},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523088162996_1523088176955_0.1688512996287821"},"_hasShrinkwrap":false},"1.2.0-next.1523149268591":{"name":"puppeteer","version":"1.2.0-next.1523149268591","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"294f33b75c5a7c87d447816218438f56c2d56f0e","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523149268591","_shasum":"ec86057101d7a5918565f86b4e5f52c337e6dc7d","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"ec86057101d7a5918565f86b4e5f52c337e6dc7d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523149268591.tgz","fileCount":51,"unpackedSize":274828},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523149268591_1523149281961_0.8395062915154172"},"_hasShrinkwrap":false},"1.2.0-next.1523149297195":{"name":"puppeteer","version":"1.2.0-next.1523149297195","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"57fa690724ee3b6091754dee7411935087c1d0fe","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523149297195","_shasum":"518b015fdbe4a8a651f70963f814c78176d2bad8","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"518b015fdbe4a8a651f70963f814c78176d2bad8","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523149297195.tgz","fileCount":51,"unpackedSize":274877},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523149297195_1523149310020_0.0038404264587592607"},"_hasShrinkwrap":false},"1.2.0-next.1523149483176":{"name":"puppeteer","version":"1.2.0-next.1523149483176","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"717d4a7ada6f82a8dce8f801a7136d15c3b17df1","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523149483176","_shasum":"5f855b1645ad751218905a6b1eea51fd404467ba","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"5f855b1645ad751218905a6b1eea51fd404467ba","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523149483176.tgz","fileCount":51,"unpackedSize":274877},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523149483176_1523149499787_0.8834209933047656"},"_hasShrinkwrap":false},"1.2.0-next.1523309842933":{"name":"puppeteer","version":"1.2.0-next.1523309842933","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"a052b9e7740fdc6648ca5241614d10cc29e99fc3","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523309842933","_shasum":"221f5903eeba24728c34e05d7f8cae4012ba8df4","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"221f5903eeba24728c34e05d7f8cae4012ba8df4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523309842933.tgz","fileCount":51,"unpackedSize":274877},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523309842933_1523309856879_0.48694968116882453"},"_hasShrinkwrap":false},"1.2.0-next.1523310677066":{"name":"puppeteer","version":"1.2.0-next.1523310677066","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"c86c12e605bd963d72aa657ecc9d89629f5a8252","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523310677066","_shasum":"7d0590f5a8f8f656fad8823e155db92c51a57326","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"7d0590f5a8f8f656fad8823e155db92c51a57326","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523310677066.tgz","fileCount":51,"unpackedSize":275077},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523310677066_1523310689172_0.4568541816432212"},"_hasShrinkwrap":false},"1.2.0-next.1523314104076":{"name":"puppeteer","version":"1.2.0-next.1523314104076","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"06d61919efcb3a169e101503ffbc603e4e8b915f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523314104076","_shasum":"d104cf6f1484cb24bf60efba935cbab2f4da9cb3","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"d104cf6f1484cb24bf60efba935cbab2f4da9cb3","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523314104076.tgz","fileCount":51,"unpackedSize":275077},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523314104076_1523314116399_0.2215185320341604"},"_hasShrinkwrap":false},"1.2.0-next.1523317263232":{"name":"puppeteer","version":"1.2.0-next.1523317263232","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"5d106f79d8a3d92d2a854cdc8231c14e03748937","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523317263232","_shasum":"c4d6c40fcf075dbef90ccf54773ec7b91e255dee","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"c4d6c40fcf075dbef90ccf54773ec7b91e255dee","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523317263232.tgz","fileCount":51,"unpackedSize":275077},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523317263232_1523317277268_0.10584168375686498"},"_hasShrinkwrap":false},"1.2.0-next.1523336680826":{"name":"puppeteer","version":"1.2.0-next.1523336680826","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"c5902de5d84f619cd5e4ca81f5fd1c30889c6517","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523336680826","_shasum":"61defa878275c0525a7ad8b9e3aef78ac483bb3e","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"61defa878275c0525a7ad8b9e3aef78ac483bb3e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523336680826.tgz","fileCount":51,"unpackedSize":275168},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523336680826_1523336698196_0.09459833695396247"},"_hasShrinkwrap":false},"1.2.0-next.1523338363805":{"name":"puppeteer","version":"1.2.0-next.1523338363805","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"2b95774af97cac778387838715e955611e49a5b1","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523338363805","_shasum":"87fe68edd103389a049816ef56022b814d178eb1","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"87fe68edd103389a049816ef56022b814d178eb1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523338363805.tgz","fileCount":51,"unpackedSize":275168},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523338363805_1523338376396_0.8251565517970452"},"_hasShrinkwrap":false},"1.2.0-next.1523342502622":{"name":"puppeteer","version":"1.2.0-next.1523342502622","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"fafd156d7bd9941131ab31f5af7cf047e728142c","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523342502622","_shasum":"bdfa63906d5a384eb02e6877c056fbc8082b59eb","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"bdfa63906d5a384eb02e6877c056fbc8082b59eb","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523342502622.tgz","fileCount":51,"unpackedSize":276261},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523342502622_1523342517465_0.3668963884527321"},"_hasShrinkwrap":false},"1.2.0-next.1523388455344":{"name":"puppeteer","version":"1.2.0-next.1523388455344","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"beea6f9c829928f472b1dc78e805314099bd5658","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523388455344","_shasum":"aaee5080fdb09a6ced9cae7f1f13d1fe13faf7e2","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"aaee5080fdb09a6ced9cae7f1f13d1fe13faf7e2","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523388455344.tgz","fileCount":51,"unpackedSize":276261},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523388455344_1523388467739_0.054867659057101115"},"_hasShrinkwrap":false},"1.2.0-next.1523394876742":{"name":"puppeteer","version":"1.2.0-next.1523394876742","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"5089d2ec2e6652a04f6d01a8beb813857dae35ca","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523394876742","_shasum":"112794cb1b6133ab5a0c4df938e0bf1f17245f66","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"112794cb1b6133ab5a0c4df938e0bf1f17245f66","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523394876742.tgz","fileCount":51,"unpackedSize":276438},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523394876742_1523394888211_0.03224183508825429"},"_hasShrinkwrap":false},"1.2.0-next.1523401321974":{"name":"puppeteer","version":"1.2.0-next.1523401321974","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"a7d59b587e6b8a180f24b8275ce98c63da58de91","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523401321974","_shasum":"1137b4d825a20fcc4e9d143af97e8399f664caff","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"1137b4d825a20fcc4e9d143af97e8399f664caff","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523401321974.tgz","fileCount":51,"unpackedSize":276905},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523401321974_1523401334428_0.25349864322039206"},"_hasShrinkwrap":false},"1.2.0-next.1523408878908":{"name":"puppeteer","version":"1.2.0-next.1523408878908","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"0b64242f850f16eef850180e7583c3b13a44e2eb","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523408878908","_shasum":"a0df9e99db84b817df451af17a055d4da20a64b1","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"a0df9e99db84b817df451af17a055d4da20a64b1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523408878908.tgz","fileCount":51,"unpackedSize":276905},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523408878908_1523408895735_0.050634705997591345"},"_hasShrinkwrap":false},"1.2.0-next.1523416053090":{"name":"puppeteer","version":"1.2.0-next.1523416053090","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"18f2ecdffdfc70e891750b570bfe8bea5b5ca8c2","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523416053090","_shasum":"1ad6eb1202a50578eb41f02197506fbc4242f0d0","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"1ad6eb1202a50578eb41f02197506fbc4242f0d0","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523416053090.tgz","fileCount":51,"unpackedSize":276934},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523416053090_1523416066050_0.41831254135712026"},"_hasShrinkwrap":false},"1.2.0-next.1523417075075":{"name":"puppeteer","version":"1.2.0-next.1523417075075","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"f8cba455ba5d1bc82721e89fda037e86213b02cb","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523417075075","_shasum":"93930d56900d3a9886b2cd5f0e94a5c9c87266a0","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"93930d56900d3a9886b2cd5f0e94a5c9c87266a0","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523417075075.tgz","fileCount":51,"unpackedSize":277172},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523417075075_1523417087210_0.8713199773876306"},"_hasShrinkwrap":false},"1.2.0-next.1523485686787":{"name":"puppeteer","version":"1.2.0-next.1523485686787","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"04991ad025d84ebe2ce3f62b871f41bbd3badf2a","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523485686787","_shasum":"a5b406ff86e489fdebbdf07cdfa55fbbd1cbe80b","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"a5b406ff86e489fdebbdf07cdfa55fbbd1cbe80b","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523485686787.tgz","fileCount":51,"unpackedSize":277172},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523485686787_1523485698935_0.40418530104114847"},"_hasShrinkwrap":false},"1.2.0-next.1523546977615":{"name":"puppeteer","version":"1.2.0-next.1523546977615","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"98bb2615adb6815c91efcc59593b49e2ec8c3935","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.2.0-next.1523546977615","_shasum":"7a67aff35f5a324fefb232c50b0cd05577f68f85","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"7a67aff35f5a324fefb232c50b0cd05577f68f85","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.2.0-next.1523546977615.tgz","fileCount":51,"unpackedSize":277326},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.2.0-next.1523546977615_1523546992701_0.63759669445466"},"_hasShrinkwrap":false},"1.3.0-next.1523592878900":{"name":"puppeteer","version":"1.3.0-next.1523592878900","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"bc8bd1904ef8993f9b83d3bc266caf9ab1f1d874","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1523592878900","_shasum":"6fd31eb1e9391801f3b564c1182159b3ddece4f5","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"6fd31eb1e9391801f3b564c1182159b3ddece4f5","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1523592878900.tgz","fileCount":51,"unpackedSize":277326},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1523592878900_1523592893508_0.7765713830264649"},"_hasShrinkwrap":false},"1.3.0":{"name":"puppeteer","version":"1.3.0","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"bc8bd1904ef8993f9b83d3bc266caf9ab1f1d874","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.3.0","_npmVersion":"5.0.3","_nodeVersion":"8.1.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-wx10aPQPpGJVxdB6yoDSLm9p4rCwARUSLMVV0bx++owuqkvviXKyiFM3EWsywaFmjOKNPXacIjplF7xhHiFP3w==","shasum":"f571c5f27153ca164a8188e6328ce2e4946878f3","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0.tgz","fileCount":70,"unpackedSize":563523},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0_1523592911851_0.7518893780969733"},"_hasShrinkwrap":false},"1.3.0-next.1523642474853":{"name":"puppeteer","version":"1.3.0-next.1523642474853","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"6f4a52bb2aa3be2f7c90e15deaa08d8153876e2b","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1523642474853","_shasum":"cf162dd667ad9f70975cfc1e1de4858bf9ccd1b0","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"cf162dd667ad9f70975cfc1e1de4858bf9ccd1b0","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1523642474853.tgz","fileCount":51,"unpackedSize":277326},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1523642474853_1523642487574_0.005171807687216257"},"_hasShrinkwrap":false},"1.3.0-next.1523643903145":{"name":"puppeteer","version":"1.3.0-next.1523643903145","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"d244fced434b5ce1b290451288357f27295b0131","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1523643903145","_shasum":"2a38823d5554d018e6ae473fb005d93a2e76773e","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"2a38823d5554d018e6ae473fb005d93a2e76773e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1523643903145.tgz","fileCount":51,"unpackedSize":277326},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1523643903145_1523643914435_0.44015500502985927"},"_hasShrinkwrap":false},"1.3.0-next.1523903632662":{"name":"puppeteer","version":"1.3.0-next.1523903632662","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"9a22f64257bc30fa97386b72019ebff004f85761","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1523903632662","_shasum":"86952a9cffd2f6f24f66d630db190a133aa97c84","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"86952a9cffd2f6f24f66d630db190a133aa97c84","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1523903632662.tgz","fileCount":51,"unpackedSize":277376,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa1OyfCRA9TVsSAnZWagAAt8oP/14DZIOAgkCXxv7bPzxD\nERQxLiIpl0fSttsQ8Caf8C8WQ6b2cMHzpfwZVt5IAx2Ji7cuRC4tMnfSKvjD\n35UXKjtuem3sodOseRfjndEkfyJiF842WvQj0tNe5okcrJIhr2QiBjArg0JU\nVuSFmwA4IgM3OCy/PNRE4Gs+K4XORMhNpwPm5SaMxm6MHsNjnUaZXCvMogU3\niI+LqUC4j3W7AtRxNeDEGABKl/jZ8VJVQh+w3/D3E4kr4VO1vznjfiDigTfV\npABhgqEtFr9Unidu0HRJ/W1lROo3zYR430cW0ycsgJ78NFtHCBoyM7zsGIOl\ncgjWDbk9ce4PIx5WF9+S4p9b5nuN6kqPR7ppkYAl5LO/BRYIgegf4zqxkVdA\nK8bztGid5hOtkxrUWkzlEMyNndw4R5p9W89GbmI5rGzU2iHEpdluag87BrMw\nrhmwpycrouo8ecRIl/OP5wnUCyr/EbtI5xIVl0yP8664TXU+Z8Uk4CRZVWBi\ntt255n/aW088TefXphWX8bpas3em0HF4pCiQLVkZ4aLg/zIzMGvczbrtyh2C\nbTsgXI/ptVJ3QJB5dpGI6DttxGs+sWCmdEbrq+HRF06+tkQjWfvj3Vkep0UP\n/SSd7RXt/M3b/vZxDjQRPRnHO8NvhoP4I84Vsyr93QwCMaxlqOcz/YhdwNPQ\nVJ/w\r\n=IcVq\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1523903632662_1523903647096_0.20514375546575359"},"_hasShrinkwrap":false},"1.3.0-next.1523922910902":{"name":"puppeteer","version":"1.3.0-next.1523922910902","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"6eb6ce0ec96f8c888f274d21eb10ce79a7bb9b99","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1523922910902","_shasum":"6aa06b3f9edbe71c9145cb0ef791ea912a855e5c","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"6aa06b3f9edbe71c9145cb0ef791ea912a855e5c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1523922910902.tgz","fileCount":51,"unpackedSize":277376,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa1TfqCRA9TVsSAnZWagAAqrMQAIHp3J59mESj6fetodcI\nrsy/XsFrlgm6ggXu/06vtUaZLaMxf6eOXQy8wI9glcUbcsgoBe0T85Suje99\n6VjOYwacastvFLmsAAtJwEeVMXLcOkXp3mog2VcaN5ZRuZWZVQPRhLDncYDe\n74m+MV31NxhJILeKvRIhITXdU4WAkexRIBkN26XADrbSDA/6009zzxSAjQc6\nrjGoWhytPiPl/bs0qw6Ir6Bbo//MT7ExrK6xJE+0khp4UC/6JxDQmC92tdlj\n/9y8r2PR/8qvf1ZS33vVStfLp/0LSX5tdzLR5YALss6xYdo7RU/Jlm6bEI5q\nZuwOY13IUBV11VL1F7dqTIipEgNsCvjQdWfwbNhxPA/daKfnfwPvJay+zxaW\n5M5BzXL8kIR9+bx1p6CVbshIupBErdTx5WmP7BWMy4ha2UNSulrmwymmrySt\nAYi9KgsuPJpXkef9ewmMOZ/ubtVvs7BWyPK3I+sV6Hv7JzIapB/HcPhtxr3/\nHTIjlq4VWmm9u/Vab6kjfAu1jDRlcUAvMiITVLHu3BAO/Na+BWQNrok5Ifp3\nZU7NyqU3MnJdgzNnbmFHGqFxEhxJztcq1BdY6nlFh+ngHkXAWwUjr8pswObV\n9DHL1IuUM94sAj2r/+QLTBbTNMRl9rDK+0rY7df/x+HdQccCyyeE0zTckIpq\nvyjm\r\n=N+/a\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1523922910902_1523922922377_0.834112055733742"},"_hasShrinkwrap":false},"1.3.0-next.1523986823398":{"name":"puppeteer","version":"1.3.0-next.1523986823398","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"082b11aa572fc10a0eee69a0f5c1680e9a9b28ab","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1523986823398","_shasum":"67f9b03d34d635666d8eaabfb7c0e8ae86f23b23","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"67f9b03d34d635666d8eaabfb7c0e8ae86f23b23","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1523986823398.tgz","fileCount":51,"unpackedSize":277653,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa1jGYCRA9TVsSAnZWagAARNIP/Rm2BFgtFwYa6l8Enqlk\nkfQbkJb1zir1dtwdx34hntKNNgOnby68OD2zxMKViBLssZ9ektUel2tgOcQh\nXo3oS3GX2VhFZGVkl2Kxg6Xb2zL919ly2PnPtAylwPxs/39ijaN8j0zwbJd7\nl5w9JBBSVhVzlVrmIMj2aEs6teuH35GcLf0bK9CqvVvIEoCE+MaruXM0zgRN\nb0rWWbZs2vLD6bRPq0SnwgcjLwiQhSWPMCy/9HwIFNePjz3na5suR4Ba0EmN\n7ADOqFxTZ2daDyVd/RpbCvwwLZvam0w1mf/Cxc9GpNKRme6+/2rk4AK8NGVs\n/e1RfuOTgMw3YYhBuKBpB4m3DehVPdxVXtmi3iQmq5KS0OERL8zxUR56L6fC\nXnlgikHtmnI4afZ+AnZ3KK19egtQjJfPEavDJytFCukOqOe2IaYTeNSdVPfk\ngUh/kkU1O7IEIlbLGvevwcmqpeYjKcfrOKRAbVjV13IB/j397Qbjc+QEBLT7\nE8ybhq1X5u+5+OthZ7utrt7Uj1sxltkwITYTH/2J3ic/QiQhQvPBoXfprMAw\nOKwO3ZkoTrsko6NZlY/flDSHOKvzkQNBDIW9pGUrkTzBZWTzkrf9ixtohtQ9\nVujsALRW6oXqcXBB9sW/ESKRc7Rq3WSEpkmOLv3F/vlrTJMx7meedqMfci7D\nemDF\r\n=PpKy\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1523986823398_1523986839922_0.8264640645832171"},"_hasShrinkwrap":false},"1.3.0-next.1523988011170":{"name":"puppeteer","version":"1.3.0-next.1523988011170","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"549031"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"62fa3bc81ed473efba1841209e5898486361864e","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1523988011170","_shasum":"c43d42dbd92d5523e454b844eb01fabb6e8b36d1","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"c43d42dbd92d5523e454b844eb01fabb6e8b36d1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1523988011170.tgz","fileCount":51,"unpackedSize":278128,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa1jY2CRA9TVsSAnZWagAAzHoP/3LjH5MotjBfE4H7mxrK\ndf2sEVv4u8jd1/EzZCN2XZ82KGI5xfLcw35tJDgHxIeXOxqzAMnwSEqs9xzg\n3AEWnml0dOQiPjk69Vh9jUNqLwuu5KCxBW+QENQtpjyhPqgCRmdZRqUe8h9A\nSNnF/54J4ZawfaDK6mOaaoNEXi8CU/9OYweDGINkS/bicZfxlKvceN7R6JTY\n83CPsH0q9/sDqet9+WWLYKnjqEFUA1XjbYQPJhqcEuyELi/YGnsQrz63HHcT\n8AbI027/hgGG2nLEjcQAU4b4PHCmOtAkgq9KMN6soFVsRfw0Ir3NyZ98KTuI\nBdgRo4b4Wxe6zPy2f61q3nQaLQAsifhKkIrgu4YAVQtin+8ZIPs+oqZ3YJe9\nZV+Mtyd9h8S1Lq6VRXWYx5+lcYlW8ejxMR7ZtpFlo1ReibRjDsh5SWZTcZ9q\nF8owvCe5PHyq+jLQwB4gxKCFhCWn3uarx0HGp5umhdiyly8ERPGWXzctdy4o\nCGt+dtBJqYZcss+5zMZSwVoPw5C8+FKxbssGEVJa2SFb8zovmW3mZ1aX6Sl6\nd3jMcQOnlfWisSgPQQP3Rhj2z8ZnaP2MRtmzznwdEY9nixlschPOZjbjCXfZ\nXNugdgMbHzU7P+8inbwc+rbH31/Ekoz0v9lse71/M7Ma4YNxw8H0bZZSQ4z6\nt/cY\r\n=MGU+\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1523988011170_1523988022505_0.5209346292017618"},"_hasShrinkwrap":false},"1.3.0-next.1523991031219":{"name":"puppeteer","version":"1.3.0-next.1523991031219","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"551292"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"b40e381f654902052af8d57a833f80aad11c7458","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1523991031219","_shasum":"aadc3d0a04cfa8dcbde8881bd221b13fccb5b98f","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"aadc3d0a04cfa8dcbde8881bd221b13fccb5b98f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1523991031219.tgz","fileCount":51,"unpackedSize":278128,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa1kIECRA9TVsSAnZWagAATGoP/RB0CqrPPbwyQm/i0Uj4\nneyLELVNU/lJ9z/mmeaQ+tFRrS824gMhGafqn4R55Ex5oDAMzCsXxdHdD6+6\nNrKpF3V7QatZZzmY31GG0yIYqKfyU9TKL2wYj9GZqbbTQ16LXyCT3SocAVPp\nN71+oOKG8bqiSTJaHUfHM/SYeUipzGgpFaqGi+oIMqy1OV/ZnnOo/Zz0lYZ3\nykJY1HX+7XBwvcnWsLodQpJDk4IO3JfGr9jmLGpwyIsMkJKrPYC8j+rcmeN4\nPuB85ZyNZzXas041jX2Kly5yNcVHXotrmy8dKDNUtt/LB9Vn7pZBTN7UMFST\na9meK/dmY+uyUGQHAkLhA7vF24oUeXrl8RIbBqsbJGuUueWtjsgmW/iFBhMc\n0egXDLLnCJjPMeHiFuMxW6eXqzgtOoW2n0hQff8+wSpGZTRTlc6C0UzA/JYO\n6/nGJXfO1yWbwulMFONmytmHQhGpDVR55Mv/tje4XVCjW7ur70Ys725fdWvj\nvBUDG8rcqDe0cap/HSeymj5x+Sti7P2ujqCWQvyPYug4u6sF4/25Ke4WjuPf\nsAgXIm1ECAPEiCIuyO2YqjEpCRNl9EMz/iWH9LMsNejAeqeaZWsKhOwbU8wY\nhyq2HYh9zB3D6RChAI0xFsqFYegiU4W0w4yO165T5/30PF+rWIWCsgGeffEq\nUysB\r\n=bjen\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1523991031219_1523991044274_0.17193320042839155"},"_hasShrinkwrap":false},"1.3.0-next.1523998304267":{"name":"puppeteer","version":"1.3.0-next.1523998304267","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^2.6.8","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^1.3.4","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"551292"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^1.3.1","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"ed4be10ae317de0ddc16f00c9f22e963028634d7","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1523998304267","_shasum":"8b5c54d2ca3c572ca9671e6484864319f950389c","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"8b5c54d2ca3c572ca9671e6484864319f950389c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1523998304267.tgz","fileCount":51,"unpackedSize":278131,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa1l5zCRA9TVsSAnZWagAAdtoQAJdqG5Mc4eArZtL1nRsf\njbqamfdtAx1HGi27PHU1Lj6y3TVag+r9wr9XG34TDv7O23vD1rEhHdwPpKCj\nlh7z/c/sjZtz4+J1g6onAIIpbtMVss0D79RibY5yZ0rc3OFHbA2pzeQiRnn/\n/ri407BQ1r8d1VM+E6lAm9R7Ild/fp+VSA/tH41OV1YmKO7uuUrAWx9bqjZG\nxUm0HOK4c8sciZcLTXWcUYApMeEIGtF1xAYNKp3LlmYZvXBkiU3rj0jUKt8t\n0snKZ/KUIF2eLjUWuuoXx0k8vC74XmbfDjJhtxEPbtzmnKlhXwiPDvoUC8QU\nsaDMfqu3QInGkZHqK10abd2gRG5/EaEdEXs3/x42LThvIrRp8pufgFIFGc4h\nTNZQdhivnGy5qUNg64hfrWxMOtyFZ3mVxCUuURtng/pq//enVf/5jA0+/bwR\naR7tgcWxW16iD4SuBxzUxCXojbJXJLAiab7OKz2Zul41NcO8clWkQiydoUnf\nmFXEMIGcb0LCk6DlpYQh9kSzuEKW/eqT35hpDDNB4vq2peuqb53mHmDp/6o7\nlPN5UNPgwTOF81576cPijJszBN7A50CQ4Wf1eh9eZAOAvv7fupSxm6Ep6fjr\neuR0HHXd+aeMnEXl94n3oWefVBQj4dtGuZidku5L2oZhYTtH1lpNNbnIOykS\n/afQ\r\n=WLt3\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1523998304267_1523998323195_0.45291864392807524"},"_hasShrinkwrap":false},"1.3.0-next.1524002007381":{"name":"puppeteer","version":"1.3.0-next.1524002007381","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"551292"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"37cc9f567d9c2d8da1eeb630d13202e95a48cbed","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524002007381","_shasum":"7ee6665982f412c6edae3098d5ba56c74b99592e","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"7ee6665982f412c6edae3098d5ba56c74b99592e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524002007381.tgz","fileCount":51,"unpackedSize":278132,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa1m0iCRA9TVsSAnZWagAA/VwP/j9dFM0iw2GUD4DxpKbU\n6q+m8FETQgH6SsPzKKeG7Kw5h0q1uDNvlR6hdcbhQApH+hu4B0DVQm9bHYwr\nFy7SgC3y5HVC3k4LOxenNSUNCMjsBVLN5IxoGz3IudwRoB50ZeOqm6zfFLXc\nS7Jubtas5vjkFXeck8USKtw+y0hLR5CSxF92tr5ykIwutULQD5/NVawmUgit\nXPqUPWC3Qs6LpvMPWnHmyVT2jrR2Na5dLkhltEjc369eHMqiSLNUVQ1sLlx4\nGvegUbKEiDYGVGX6S4e+PCV+tF1Qc+HsrCzug9318rkFHkn9GSc+XzDSXZAo\nCzMFheRgTznwXogB0on6Q9+lIoHZG9N+bKgg7QXFQ79vj5pyv904h+gMrTv5\nW58AmYjkFQTLs5J6rOnPXbbNWpH2vj2CCWkl6yK7LPohgMWPAbD8/lajXpKA\nWPBkss7YIEZG9CIW/T+FgUzy/pYk92nZhKwKBiQ6vwWbEwITd/ifFg8Zhx3c\nkhC8MrJi3jm1ADW3ilnRUqgzHIxeHDHN3X3rh6muIREjHSGJWh8dJuIYxQPe\nBsrVlDZEjY3TBrYK1XtwKxhprp/PqR/aV1QkSmqGG8GRFJg2nGQ5VwzwGIvK\nnnb649T62V7XRnxV1GShjRq3RKUEgVQs2073QmtJKZR62sdSmFhL2+na1eMf\nLv8b\r\n=SOD+\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524002007381_1524002081825_0.9000779684230873"},"_hasShrinkwrap":false},"1.3.0-next.1524077854221":{"name":"puppeteer","version":"1.3.0-next.1524077854221","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"551292"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"457592308fc97059930f82dfcdb26b37e33cc018","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524077854221","_shasum":"43bbdc9510c06a9deeb327b4a22c2e4692c36ac8","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"43bbdc9510c06a9deeb327b4a22c2e4692c36ac8","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524077854221.tgz","fileCount":51,"unpackedSize":278132,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa15UqCRA9TVsSAnZWagAA3/QP/1QbwTVyvpmEA/WDgC56\nPPPW49AZs/cJeNimejWlOmpwJ7VyKYI5sOkKGClFNd53uPBfBRFpuaFR+FOZ\nh6+irTkiBHOxHSazfZQN7BzZ9Fn3GIBmJ6RJYfundYe+93MHXtV0hfnt99X9\nV+qTehojz9zFfg/Bao9skX1rr2n/TcNUG+FPlzcXXBqRAjh90ZQ6G/jLSsdA\nF7julULGhmjX8uRyeLSQ7t2neGFdff5bvIpXiYyTsG66h3BOtepEsznkJmtP\nrUj1S0ULKxMz02aNslIV29KZR8LFInb2fg/14XdElip0xhb7ei1vungWdutM\nxArH5/gqEeEJOczX18HY2HWk3OuU0mvimpsvZau8DUOntU/97lh28rfNWhWF\noJJWdvGnZZacTs/V9Y/8SM3l4BNjbzZpL5QEw04+vmk2zs1M/M/Q/5sEHWCj\nm2V0VUP0A4XEXIVQ+jaBoePSXvipROyo0Kli2bmJ1fnBEqaYyznLE0wf+guP\n7lu6HI/QC+vWNJwx91VOhWev5yWPbVDymMpy06hPbUKis7t/f52a42x7HZR/\nV8e4AyE+HwSm0VYilmgKKm9Ir4ELrevaHQJyPA3zQQWno+Z9ACnVPuD3O7r0\nf0ujPhfpv9ucGqKiV70GGtXDIJEp8ONpt2lq/gbg7G+hzlSjgIvEL5iNvcED\ny3Os\r\n=AJwl\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524077854221_1524077865794_0.10949776920275611"},"_hasShrinkwrap":false},"1.3.0-next.1524169798128":{"name":"puppeteer","version":"1.3.0-next.1524169798128","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"551292"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.2.0","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"6bc98775719ea12598aeaad0736cd9147c3d69b2","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524169798128","_shasum":"08e779d162af76fcca51c2105ee0fe17855c0e87","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"08e779d162af76fcca51c2105ee0fe17855c0e87","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524169798128.tgz","fileCount":51,"unpackedSize":278162,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa2PxSCRA9TVsSAnZWagAAdF0P/140If2ILMJ1fRd5nPx4\n6W9Xc7B0qHefSY6L4xX9mLqKhTNJFqmcf+MKH31GtBh0zbmc/FkgGXgUKCvw\nbyf3eOPahT2EkQxwF4rIvBselIGrYcpOjOk0V1xuzppJOz349oyuug9pg/tE\nbrCJXCBP+ezv4CJbM6H9qnJ6FYhLeTRy9OaeaOuDaSCJ+qFoyoXoSIxzBjSX\nadC7bw4up+g8j5J/wJPFnn3Bg1YPrlPoxD1bvYcauf57yMrCq8hDAq3cQN1G\nls3U2fzPSpmZnFGQiqqkpGD94pqjlTbQZybNx+dsyIXkLNvoUq+dp49aqWfr\nSPJTvLdHkU3pxiPg2BJ/x2xbYMdQui+vS3cTsaI/2bdKBuuHVMdOZo03o7If\naBxwskSWtkuSUEnsGLFFMAAvMss1o517EsayxIT4CdDjDW1Yts6TDPv5OTC0\nQUx0nb+wNE0uRFLwZ5F45RsKBwJdFwm8ongXaWFYnoQRUQiAcWOPgcxipR/1\nxHkl0z1DnKczn9315bIe3zkaSKo/lvxKT1WQjTTXZmZKuQ5RGZRpqzCnPsx1\nLPRYssBdZa/P0Tw0tLfvWT44eImQ27yzwwbqX8L0F708qUtH0eYXVPVxyxNg\nPgLxoAqvsHFCqKHePdu3vIZZ5yWntxdV5Per4JlG9s9agIj13ya2wG666ZtZ\nHNIU\r\n=XAsk\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524169798128_1524169810035_0.40032558311988664"},"_hasShrinkwrap":false},"1.3.0-next.1524172726027":{"name":"puppeteer","version":"1.3.0-next.1524172726027","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"551292"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"6ac7f75611166f56f2b8ca3bdf61e290fe3343df","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524172726027","_shasum":"32aaa8bd247ba443b271367156f0b3d8c5cc6fce","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"32aaa8bd247ba443b271367156f0b3d8c5cc6fce","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524172726027.tgz","fileCount":51,"unpackedSize":278162,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa2QfDCRA9TVsSAnZWagAADagP/jk84Pnsa+YQtvgWkoZ9\n5yh0hK1AvMsW0MBmH2nQvzUPRMgh9X+yrl1dvmBunIRrbribIn1/wpAoV80e\n2Zr/dEdb3BsNi/wg3orEX6oQDFlTH1NXd6eKJWJIsrBKBykH18wcUivNsalM\nkSXQItymtBeHpxqA9dCvfXnCJUNUO6zyXf/kk4Q5+RZQh618p0VwlLLqxHBE\nEPiq8CDZtRee9kx0IKzPEk7F7oWPCj0zfmn1MHgrUPeNnnyMsy4Eq9jhhg9j\njdUXguJ0gvWfJZlOTcYytPgmSF9r9LyOnGGxYfRIeQPaKULe/jX83s6W1iMz\nZ6ztUukQEONafuMhctRYUzQp7WaNstVHJpq9RsA6dQRnKWWaCJr0xSfTXJ8a\njBjGorgdyn7ZWtc076z9MMZ2CPXuvHZlkKtJB1BYXqenlR1NmwIqFMt958Wk\nuUz9YFMAa1qhFTZC29+1nbj7Kd8qKYnWDK/Q0kzWoAWuVrckukSekoho/Sbq\nvyn3SnUDx/02M48Ch4z8BR2Srz5N2Rp7mr4VSjFVWCdnuY1y/IjjXijdlEtq\nk+ZBQSLQ6+Gh3jtvK3VDjqnk41yui1kirlrQUH+MPCvRGP+QSQRTwQqhpXzN\n0RmKBp9mcCZNI9iUuhKt/KDifRS04bX8nKD0Pbx3kYHLC9K29517W+xqsfbo\nFOtb\r\n=1TGf\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524172726027_1524172739070_0.048559909627653663"},"_hasShrinkwrap":false},"1.3.0-next.1524503013067":{"name":"puppeteer","version":"1.3.0-next.1524503013067","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"551292"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"e9dc3ae74fc01a99d1d5b66ffe716b4de4aa39e8","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524503013067","_shasum":"44cba24f61cac741794a79fe6bca7ac2c8bfd354","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"44cba24f61cac741794a79fe6bca7ac2c8bfd354","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524503013067.tgz","fileCount":51,"unpackedSize":278162,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa3hHyCRA9TVsSAnZWagAATE8QAIHTFT4RGLeAO0q09pHv\n5vfjLdZPMX88K6/wxvPeYMAbQ4UyUTpIaBASN9Db0jOXVw0mPzRkQosL3S+g\nryWq9kxhFlidV6rJRZK13BVbr7hNaeTSGKowNE8PNvd1Votz/6iVX2DC3X02\neQIzPcC2PdenIK6oY3ShCIlucYyj2RxpqImqr2LONkq4OX4JEZmrQRIpsuLv\naRTsxW+t6nmWmyCqfERCJo1SissCCAl5n+lX51vdGKwZUsYZ3YLpLO64Vcqe\nDK+j3YCHFskBVR0FvUvttwtmjCYcAq8iIhmkVreBs3DW16IoyPvfzXXqA5j6\njG5vEN97KY71g2TdLUlQO1RC+QWtar8KSpC6VIvYlIXw/lwoFXLDtyTS9s9u\nyQd8VsERMv6m3nskEef4S79mk8xtYsiOD0GLwD97SkjC60SWvknXLA1tfumd\nCwiDnXV+SFDC3EJl38SYfghTPYmUt/zcuZ1dyUtvhnM+uLTF3qizDq9bvMjl\nERauhVVKGy86QhOv+PEq5VKjF2xmFeL+ogwzlC5ITPNVgp6pVdutrUxllqRw\nbDcpaRwE34rYyoZuF53IZnw8BYbGc1YBBcVMWIsm8Y+DwOasVs5jWWZBHYAO\nreIuqe3JERSIRwFdbSK1xxmRdMi3AHpX83NCxLuzves0boAzUzNkqG4fJnZZ\n0Z9c\r\n=pMB0\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524503013067_1524503026089_0.7121665347917439"},"_hasShrinkwrap":false},"1.3.0-next.1524642447975":{"name":"puppeteer","version":"1.3.0-next.1524642447975","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"553380"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"84d7b4963ef863a296fae6f815b6f240a7262a16","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524642447975","_shasum":"889e61549f02320c9129b7309bf479df912bd214","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"889e61549f02320c9129b7309bf479df912bd214","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524642447975.tgz","fileCount":51,"unpackedSize":278162,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa4DKeCRA9TVsSAnZWagAAOJEQAKUPFp21VxHCVpusKebo\nv2eztF5W+9fDpUYmRKkDptJp4m8gYAmCEIXle6SM2TBC5oIeZ4f+E7MrU7vP\n0n1PKDRFGIORhQyjeCzTDPq5juCzwo6t/DwA4eYqb9Nobf/IhDJLolXgZkz0\nYEpcKgYOo3Bqvx7A4FO4tSTr1wXx9NIAGafeC9H0mfwCW5ynN7t+0WxZkfbF\n+Kl3eKXUpY4hAHEtpq3ZMH6elZHES7pLy0uoq/jkdUxpsbfiE2+NRlRVzYpa\nfjLYIZfToQgYfwLzI+ZMlZac8jjzBt/qoyd/52RHFy39dUOeinGyCaKan5UI\nPSvkhXFR0pyR7LZ6c/IceQvO8DxJxnbyW//NKitGjTp8VSC12zyl0wZlYO46\nEBwDMrQOCDQpyXaIdtY1HiqqLmlD86ddDifPC9wZea5F9G8Ig1ZXmJGfpJZW\nC2MwLOZpUvVFFgJoTVk5zMe0v7Zr1XhDwGiyZGV4O4K2+FL6nfZUbkHkBfy5\n0pCgyKwTdhfAK/OZ9hIyCvXacbzGHUW59l79LXrmhniWx5fop4m1XsKGn+6H\n0e2kMTEsQ042TOub2t+RziQ3NT1nf5XM9Ns9s2lA1h1c3r+5d59KZS2d704W\nUNobJtU2n2zgzfXh4ffNrobG92uahmY7+r1ZfsdldxCwUA8+a/BKnfQgk3C5\neuMx\r\n=+3YZ\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524642447975_1524642461380_0.577088839278471"},"_hasShrinkwrap":false},"1.3.0-next.1524695478733":{"name":"puppeteer","version":"1.3.0-next.1524695478733","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"553380"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"8fce3195d6289313f7ed201f3efeaa1cfebf17ec","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524695478733","_shasum":"92f4b9af8c574cecd8b9a40e1737770b5dde0a06","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"92f4b9af8c574cecd8b9a40e1737770b5dde0a06","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524695478733.tgz","fileCount":51,"unpackedSize":278194,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa4QHCCRA9TVsSAnZWagAAJEsP/3X+bRywfMUh3UUMZnLS\nWfgA2jHybYzeCE4v/ZDb8nTj24D/H44Nq0OFGR94Nq5L1h71MupVlVBwOdjE\njJ6Ow5KSmg/Zcld2/OX/TAyTV6WfkAGxSehssw+3vtq76xQazYhg3hayOHea\nCB/87EboSqYzsYZBZt+4EGAG4m6FAfwt6Y9Kqya338s+CjU8F7L3hTMgTj9L\nYf+gWxlH2i8OZGYu/Z7TPFsUAoKAtDceAAVmzgDLDJsdcTNuZLiwlMB/9tiV\nffPEqQGrCe+tNsPBREXbXB2mZ63KivjHGskszXODNvcgRvMRCGx6jG/LwWF2\nmvHumPDvpMf4lpa4+pPgfxq2tvjkfYYAPWs2jqYpNsUCrcMs78wuuComqJ9l\nhPGzVseG2qV3Pks/onpl2peQL3+m2+p3wUmy3sfoMa4nS7mxXanTwQCqmNhq\njbmnpHf09zp1+Orhf2nZALVRzFI+68ifaTcDCZRWJJz9oSTv46MiMQKb4zAW\nTEQhOgwEs/siAe4+uSTtDUggT0vOwGYE23NqokTS0qD6OrL247i1NDSp/czo\nfObaJyLeJEOAv7NUKbRwjQtscbHc4WclwdfDLG9ZYGoU/dV+PPcevTIXsIzS\nxJdAAV5u/cTXLcPo1a03nu2/7YR0yQUhwWNEeC7i9QDL0/LYMbBaEKLCrQeu\nr/oG\r\n=zsmD\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524695478733_1524695490564_0.5873166036354058"},"_hasShrinkwrap":false},"1.3.0-next.1524701668798":{"name":"puppeteer","version":"1.3.0-next.1524701668798","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"553380"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"6d19db4df12d1d2300f5f72aedee5135ec314ed0","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524701668798","_shasum":"bd5ac9c90a97b9e6fad3295555b042fe94dcdda6","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"bd5ac9c90a97b9e6fad3295555b042fe94dcdda6","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524701668798.tgz","fileCount":51,"unpackedSize":278194,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa4RnyCRA9TVsSAnZWagAA+OMQAJ/4UckunQ7my1ESnDA4\nxiqWfrjlRyjXubNU3jHq+4QyOvOQYT8AkRD/NddWMQ2pYBraL4SzWcfyJGEJ\neOImxpPlq/snl6P7kJQtR9Gwj36z9xCy7ga87o26pEAwUiHOY9AEiARJM2nV\nyJBi8Ii/SZEhqTz3X6A17ogbL0RV/LeYZkYCS+hLi44cWlFiAnZKbqrsdFyf\nGJ/RxXjEHwwbuWM3Y/7IyaUnsut8tIA5LD5MhanjLX2F4DkU+EJ7UlBMYgEY\n0xtN8dQMtv7xq1S4HN+6rQVmG3herNu5Z5L9BAAt4XV27onru+V9K0Q+qFB7\nwQPD/dCC4T5Z9nbJz8+MY1uGekeQ+Nm5hF+QxujfucsdLnlYdhvff24qXwwU\nA9nmP/o7I2YFJNI9Bai0a6NU3U701lnBewVAvxa/FdQZgSWYFQZDlBygESw+\nhccVeCJT7ZctjvjLB1OGT8vCB5S6YQJHp1u7NtOrgl75KrXSJprlLlM0uwyc\nWL3u5aQoFL+8RYphCyyQ9f2PFJ9f5Xq6p3GKDnHODR6qG/HHwRcj4D7JRp7L\nniripBxvl/1b4r+BOKlE/GtEwzq2AaiUdlgQLY+hXUqy4223oxRouPVMZvp2\n/REkHHDc5MGabReILaoiUKwwSF9DRWx1jk9BoyMfBDHHBVUGwBuwqHCQvU1G\nInsI\r\n=YPjh\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524701668798_1524701682444_0.05610549661005759"},"_hasShrinkwrap":false},"1.3.0-next.1524704985101":{"name":"puppeteer","version":"1.3.0-next.1524704985101","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"553380"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"13a41495aaa95426d5ceb51d0135187d9eb0392f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524704985101","_shasum":"27728710359bffbfdc876f5361268c95348e9a5f","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"27728710359bffbfdc876f5361268c95348e9a5f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524704985101.tgz","fileCount":51,"unpackedSize":278194,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa4SblCRA9TVsSAnZWagAAbBAP/38+7WquotXD+l29zC0v\nvgsYQhVx4njZ9DRlKk4G/sDT4s1n9WTf1E3KGBjy1PeIPgJ7MF8Iu8vjGxyO\nMOiXocNXTn0ddOJd7QQzFim0QoYIl6NP5gsL6Bv78d1W7+LWyeMG3Ix4NoWE\nhyEk0gNcAYzkYhbXe/idHgqVBeUA/xTDWnE3zvn5KJ6kJ1h1/HzpPX/9utII\n6wahO+eAKJQHonlmxJNWZHOeIVyeKnBzHJ7B+F7CtfC1ciXmHbQfPCDACs9l\nIs8C8uOX+NHrI8Leqs8f8f7Ps8+MigzBWYxbPGjUID7AUrrpIq1daRGVuXON\nRhopgiIMN6vc3WJb56xcxX4wPZOba+AkA7K46QZX1Ih7/E3PEBDQWMGttJBo\npDQTvPeV0Ti2cdhPCfqYGULBYoZXjLriiSKeBq7ROE55oojMbCRCIjKbXYEN\nRMpvbErfL7ngbmgf1zD5qpM/wEK2bHQPjSJvMChu0KRgTzUlybfu8XPiGDOL\nJlgX8emrJn4xS1bK/Awp604zI+LoppB1VtfVMBsKXVxCKaYKYr1VhcCjU7Qe\nVsf1I02v4KgNCCCMwjYp52Vfow5dg9nEME+UY0hC+oorQxcoNX0h7T+UkZYJ\nRxDlnowzVPeDy3J+aSnlFC+2pea5xx5s6OBm7eqgb19QRdvtPwGKUeo75J8k\nSqj/\r\n=e82i\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524704985101_1524704997123_0.338222415919861"},"_hasShrinkwrap":false},"1.3.0-next.1524705708145":{"name":"puppeteer","version":"1.3.0-next.1524705708145","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"553380"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"0820d48f804ce924af85fe160ea20a210f734046","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.3.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524705708145","_shasum":"2e3ab99c2329934c626b9c0b5d67479659643beb","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"2e3ab99c2329934c626b9c0b5d67479659643beb","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524705708145.tgz","fileCount":51,"unpackedSize":278295,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa4Sm4CRA9TVsSAnZWagAA3aQP/iL8v/Vci/tkIx6bcxXe\nSCF9Xh7TSYJo6nwk3w4D8CxKp9CU44Lba5fwq9bBZEkm2QnmFD6ypmWhhkDQ\nSLOCGxYO1hpgF8nnIPVFZiDsuf7Hz47JPzLxpVyFFy6SPs4z9/IKant9V4Mn\ncgf94aZAETb2G4cSamFgnOlPy55bjsF73+dAPK6FDWOz1gATa2zVTfsNK0De\nbUM6px3s1hjUIw3vk1aMhFtGBgYn7xz7f4G4nLiLg3e3l1x0+9ELQFlqh054\nRBZsNil/WS3S7V21OEJpKNT6yAW1ukLoWQ8bIwE3uhhiav9JkdEchF+NcfaH\nz1wPrNHFV8/ACwONjhM0r4qi4da3mHYkNAlTn2j4VVykPwGKmrt371ts0atj\n3Jv7h/55Y8uvxfDhKEfHR//aS/hnnJkDzUmPJgel+oGsW3XuzNGHAivAeQxt\nHv0/NZwtsqad7pHBdmKMYfzvm8j3QHQYoSH4qEDEj0mPbh/Ke5KRTd+21kQ3\nua5ltfXsb2P3/TYwLxPaZyPxGDhI7K4ELcm4nWQJFse7RPnTyhNEii1csqcJ\n1uaKKOWFU82kPr4Oz9Ep6/BmPzb57zBDscP5zqpPgNKGG+lPgUWj93v9pFlC\n2K1omVyS7fmaLYbZulqlSABXdt3EI1R6iQdT8Q8Z2tkm+M3SeT4wQfZxg+8/\nTdYI\r\n=RwVL\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524705708145_1524705720475_0.9988182496488305"},"_hasShrinkwrap":false},"1.3.0-next.1524712919551":{"name":"puppeteer","version":"1.3.0-next.1524712919551","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"553380"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"d9bb7ee8a0383774c6ec32f91bbd434dc654d468","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.3.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524712919551","_shasum":"5fcffa7ef92df07bcc0c15a85367526d2c370898","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"5fcffa7ef92df07bcc0c15a85367526d2c370898","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524712919551.tgz","fileCount":31,"unpackedSize":256595,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa4UXkCRA9TVsSAnZWagAAPZkQAJ2Z9uUUW90BXVdSHHw/\ntiwJOgW/pZUmLtLqFnUxFQo1oRluWp9uG60415EUVbdEbILxIlVMnFI2zvkJ\nIGFmrv6Opmbar/l7FfAyimR9bSqoWt/ij5b3VO908fWHUuTPQ/fjt8y6dr/J\nRqqMcfuiYzNwrn1hwHJkLVLF9zBWyc8PUrdu0OKkevhDg9ZznsCtn/FMqFU6\nGV1xoFjJzF3XjWqgKGt8+hfh43Lzxzb/+z+M9U7E+uaj9rAeqlQ0z4400PE4\n4y024PgsPGa5LBD6losDLc570W93zwUojkQoBrY4QjQ1UsJeGzdnOPuM3JJf\n1Uzy1AZTgfq9B4/w7rsdtZ55f8wYj4Qvt41qb8lUCCLqq/BdN52UNC2SJrFY\nbf6bIR6ej1r3Z67mmF+vpFUVkP5d7R2vM0/sGbO6Zu4wx5TqMPcmHqYAEdkb\n6Ub8JNo3DYNUEDsKAx79NMf7xtwKNFHkUqFWYR2pXTHMA1OAWW5pwmHi3En4\nMs46lyAE5I8V9HDQOaAaJq4OPAXJOFpZU1Ap0lvohVx0oOUoGXtiImQd/9qw\nVFBvl5DkAI447lMbWZ2z8bNCKgfACagrAXXm/pKThgQU8CN1lj2nbs2ixx7I\nuFczMzD80z0iFqbEtktk+CWHWr2WXAqVbHJEgZRHaITceLhqaElWO5oGOioM\nHTU8\r\n=NrM5\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524712919551_1524712932265_0.3903432544737806"},"_hasShrinkwrap":false},"1.3.0-next.1524713000921":{"name":"puppeteer","version":"1.3.0-next.1524713000921","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"553380"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"b96815aa72063125fc1ab085dac5da59260d1fa2","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.3.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524713000921","_shasum":"75d47c3cb989701be41f1c57838edd7b09e797df","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"75d47c3cb989701be41f1c57838edd7b09e797df","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524713000921.tgz","fileCount":31,"unpackedSize":256595,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa4UY1CRA9TVsSAnZWagAAIjEP/3fQGKiRBd+XPmJsOU3D\nvdgV+y76iOZV/pGZmM5PdIJJJ8W7q4OV7D9XJcX7ss61tf5/sIgRo23uzSRa\nrSno4PWilT8eG182S/6tXS/+Q6kC1M2Pq/bvcC9NxQNMHmvYYXwoijTSqARt\nb211lHGoNpn9WLFPyEhIMuWB/sWjY6ERwXc16RWVOuKIIDAUQAG+NtjIOG+4\nldBSMliD4mI+O+ittY7/hO1UeCFxEWdIDGxJLVdokAvY0H8TBrsOzgaqQ/x8\nteBr09lCW87rrjek9oRMXDaOCwWSv1DOUDpHRGb5gLjEJ2s0jSclL9y/vEJk\nJQ/MprVnzEMKop8bD0nKCDznwKEdA2ZlQT1DT3hT7tTfcHAhVozNguJ1C7xl\n6CYHen1EV94Zyp4LYxLKfVLjQ4lns0/iDGhimk0q/SRsGM743rdWQdhU1yQS\nK0RxwDap2S8+WaN8bbYLekLKooL8V431joN31RxvwwDuFr/rMuyPJD+FQVVO\nX5AfxHmOVav2Md0EzEEZYqhm7WhNKRpMTsae3nJOnsllP01RFoOxBISPuc76\ntcgNt2UEu6eLO3ssbRwR2aNlI0ZF5utAC+LOr2h7a3SCZ8jBnyEwpN1C98S1\nvlsm36KcI8BfMLRWLSm+ZUy6v+TGoe98j0cyKfhixsSOIb2DlpuqcqTDOCOq\n+Ycc\r\n=sjC+\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524713000921_1524713012876_0.6383395532757452"},"_hasShrinkwrap":false},"1.3.0-next.1524757175953":{"name":"puppeteer","version":"1.3.0-next.1524757175953","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"553380"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"9ae64f237c2a3cc12113970d0ffe32bac35992f1","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.3.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524757175953","_shasum":"697c0a57f7a5f569be244233a8da4601d437e5c5","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"697c0a57f7a5f569be244233a8da4601d437e5c5","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524757175953.tgz","fileCount":31,"unpackedSize":256595,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa4fLMCRA9TVsSAnZWagAA+qAQAJsWNwTWwQsS9lDltHCR\nEngz0kN4oSGPLFKv81AEs/SoQ/Supi02hME5SpqqgdbEERi59pKFC4fVLEC1\n/4gsvP4MUu56NBiTP2pLRj+zodbit7IRIFP4aseycLgdGvXZwyMhINBJOc6J\nTr5mgf2LGgqRDlXyarmpamiCE+pcusxjWzXYPPotWG5DUfgDd7QKnD+SwKWu\nv+bI0PjMMEb3TPKOnYuDw5loK9nN8Ii55azp4aKEF3xbHziGI4bejQlnJxfQ\nU2XNLoTngnztyZQn3XQIk56986Sf9TEwCm/6rc42e6cgwtol1BZ6UYOTaHMq\n161Z9ZQqXp9+d/tlQmoPcv1r5QXbKqpNALahfqjAsKf76BUbTtxuOiyHXjek\nvr7LI/Mt+VMg3GqZKHdqnlf4nGEXuzkOim54x5XUCKtQrfQWHsxyRAh9sBVD\n1oS50j40ti43fyG9iYxtHQaa/SShoUORR5vMUstF2ej69EQJrgn4JQ6du3Hk\n6DM3J57A76w/pdJ64820Ci2s0qabvVnd1qzLXDyCtRMtSBf8/1dWSBWj4E2a\nQS4inHLhEOp6SDv55YW9tHjxiUz9LMr2mjl8lAFwm9YCSUYiVV+RTWIEg3Sx\nlCpLwFT5y/TIInje3oLlRLkzLHmGhozuDzjDqEsq+elDuKr9AKCYGLK2WraY\ntPUS\r\n=BjaD\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524757175953_1524757195973_0.5188622901129187"},"_hasShrinkwrap":false},"1.3.0-next.1524766628711":{"name":"puppeteer","version":"1.3.0-next.1524766628711","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"553380"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"8a62b10fd094ffe895075759bb8065433c98eeae","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.3.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524766628711","_shasum":"f066f73dd2148733ce274e6d80278a0fe6b3953c","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"f066f73dd2148733ce274e6d80278a0fe6b3953c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524766628711.tgz","fileCount":31,"unpackedSize":256595,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa4hewCRA9TVsSAnZWagAANTkP/0PTYpcnn73UCitnWdVy\nv+uunwpFQD0Zo1zobpDBbDjqzydkfirE1XGB8JtlVVYwv6Ue0LnDzzdG+bE6\nXqADJt/0brvzo4DNsNAl4soeStiF8m2woFAV1uvnyS851i2/zJAXqj3TsniF\nUv1ImtvbiwY99oqD8QWA3YGerr4qJroEIPGnIYArv932GstcfwZ4diUVKfl+\nWMtdz2ACq148tfJBsIVY/uo+DcbXcUa9BHFBBBCP3fwysu03XunFSL/3eNfN\n2bMBFKTyqMp0Nmzz44zMNsMcL4CeklxBkyyMNXHFT8Sb3MzemZ48mNyeRoY6\nJLGcq0ORyg73TJWM2B4ozBb0DgXu92PgkbJYOBEpflvz4JrMOaOQQ8yIORE9\nm0pXR00A73R5Nb0Lt3B1zbCHR5FI8Sr51noET2gr223OwfY81DGnrRBit740\n5GHzL+Vt+Pda/hniB/GVEQMx5xHlPJvunLIB7xNbS+LGd6unZHxZsUEZTSot\ndsEFLlH1bhloJsAcLzwNp3ORz/D5xJ6iq9PPCFuujY2XTM5lpIMaNJvFPVYc\nkchDw/NFuRCCkAUXEbxvW+WNgcUFYGVHyeaIZC11JcXVJmN2F80/XtgWWBUm\nAD1UMl20uXulyWiLIqDGM7st/DycgMmsryTHyl9WimTTbQBk2QlVB4xQA+Gs\ndPWW\r\n=OrDw\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524766628711_1524766640548_0.15741203351994715"},"_hasShrinkwrap":false},"1.3.0-next.1524774887046":{"name":"puppeteer","version":"1.3.0-next.1524774887046","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"553380"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"eded38c82a5f2ff1742958549b782cc974b80405","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.3.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524774887046","_shasum":"f309e85ad7b17b7bf262de74e07b251e5a9c892c","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"f309e85ad7b17b7bf262de74e07b251e5a9c892c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524774887046.tgz","fileCount":31,"unpackedSize":256595,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa4jf0CRA9TVsSAnZWagAA0uMP/38K9zvZYx5KVXkCpoZt\n87A50x26/hBdrMu7qaDLSNmTbcHmCjb2O5XHfKVJNTMzctJ6USOC1zymDdik\nbmkWmcB8afXzaF+A/29qfMe1PsqHu6Y23Iu3JChzF7kQu2OYyDOd4z6gtX/k\npSZPPpbyaJlxazNtPzOApHWUk5IvkWWw2wSANS5xNw2sDpAwnC0cqSJ/iHfR\noplU4J/huEzxNqDdNRuiY5xfJ/OI6GNY/DSWgJnwpRPT3dSzdP1gcVEKSSxr\ns+FSi0iZCGEG9+LXkYJCauvxRqkbLH2NGR2qhBP0IRCOmQxur1yL0ojK1n0m\nmih0ScY+keqgwOjqupY7tPzyDlOQhYLphvEINpVhIN31SkL7/Rt3++jYKHl/\nmll7JmB0D0d9ZcXzHbTKEvGWVro/tkKTeDSBONgzIMi/8hOUpAkJnCIOAEC2\nG11qY7Yc7wX7ZdT2aiZvT96NuK4XC+wSOTSZaWLV379BK+QS7+Vp4Mk9aMM6\nartWaN3dcSBt4wJ7n1yMBxXyRHe+pGp7B+YahSbh8hmD8iLOKt50u7SMXerw\nWyU9OTTN/lyutKKb7MEXKolT9Ew2H4YInWZYD+c8vPG4u6dRnOEFxiFFOvlr\nSYbpM2/fE3cjlNr8MHRpA/re4NoMZJQOa87CCjPG1EM9M/u0i3afed/y7+An\nugnE\r\n=ZonZ\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524774887046_1524774900265_0.4335854493872595"},"_hasShrinkwrap":false},"1.3.0-next.1524774920630":{"name":"puppeteer","version":"1.3.0-next.1524774920630","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"553380"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"f797f8c307ff5380c750d3851c0b3d61a5299df5","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.3.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524774920630","_shasum":"7dcaf6ea1e18df54e657ac97b48eac9decccf3b6","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"7dcaf6ea1e18df54e657ac97b48eac9decccf3b6","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524774920630.tgz","fileCount":31,"unpackedSize":256595,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa4jgXCRA9TVsSAnZWagAAFkAQAIHQXl5WWXllQpmFK2Qe\nEg7YLOb4HsIHEl53UExktUZAiMRe1yo7Ac+OQsXwefOmpbq077p8z8gQYjw4\nSRkv2qtlgY1ShIuijbJeOXYTN/MgRDQB3LQ9uEbVSS8atezamakdmhSZgGnA\nh+JdwHsn5iHrQYyAYFpZfn6ZcLxvOQ6wAN5fTpor7ROHpgCbpyAW6mJAI+eD\nPHGVtiCHgOR4R1lYjlZfCMe3+CenqI9sE9uPq68DpZ2U8EyhrRSsLCpNCKKW\nMmvN6vXKcDF2xRyLzN/PbkPP7z1xWw9rB2e/8F8RJT7fYWV5WLzviAMWAsi+\nxKxOxNe037FVCc7fDMm/dlqEZnHXgORxiSvORSljMaVZQ/OczD1V79A0wV0J\n9A/q/vbvKqvaoCEQj+pKVSqFyDWwvZx6/lUtGO67WWrAUpjmX/RBU1wMpND1\n7CEoV2A0S3ESavXR0800MzDTDNbfIsnDYkTbibHaPU08MPeY4WFva4Lln59f\nLG0I2xA7SLL6ktq+4nE7gCJjs0GNR2PuqpwSD3AN1gP+mg5JfpOlUdWIaY6u\nqOrmAo6kcaIztfepo6gNodX+PJOthlaTMnRCKZx5bHKGI0Oe+5DlP8qxW7Y+\nJu5Wim/G7t+TWdRd3AIFrU4z7Y20I++ww+I0/1tR1cIn7D4bTFlGXq0HNz4M\nHWXy\r\n=QDyf\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524774920630_1524774934775_0.9097607000866292"},"_hasShrinkwrap":false},"1.3.0-next.1524865639981":{"name":"puppeteer","version":"1.3.0-next.1524865639981","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"553380"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"eb1826bc4972d527bed2a0f5f4e351df330114cd","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.3.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524865639981","_shasum":"eb1254d8c0d71c344a0b853b0b0a600e57c4f7e5","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"eb1254d8c0d71c344a0b853b0b0a600e57c4f7e5","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524865639981.tgz","fileCount":31,"unpackedSize":258109,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa45p1CRA9TVsSAnZWagAATJYQAIMLjW5h1o1nb3daw/9L\n2OL7+3A3hpbNOMTvaINxcVz+XpCUFgRWrWIo+wFq4/D7Q4kn3gP2pfxzk6xA\nV3cle+YXUqrMo5IehTmh0VTOTRB0RMZGRYE+n8D9hWrAK65YOUit7pzEncXY\nr9iGE5p6VkcDMyKbKn+NWtE5fvP0LPyl5xeu6psA0XGRbFknGWEmJT/2Al7G\nwm9sXXNlWrfSxyPhcsW+FEL26cQ36pzyyOG6hz6PdyZUwJDaZglt+wgMVDaO\no61DCKiYaugr/Jycz52TWDmEQTIrGnPQzUbK3eJFDGqA2xq5q7i/muuom05M\ntVdyJH0SvC3BpCmuNS8ZNre9TwAwTH5tSSLsezgdQ7icwGf1M8Rzcx+QxwNI\nOYVHVUaxUJugfJsF02o0WXvraedMEKApuyLpOTh6A3HmhZIcRnFJ+MBuV849\nkKBvmnxq88UKMJGWKy6n1+Fo5xAWUDGR4PMrcXlV3h3Z0Z6TP4hU0kbj/xQF\nsVLlLgh8tp1oow1yTVsok0qA6KSy5R7tUDd/JfYPrk3fRI1UOVmq9bC7m9gc\n1HV+XfkKDeNkDxo0F9uph5rbJl27XxpFkTKyWZhlbvlNdTNMla2arXWVSHq3\nkDscmm02FmF6enppC5Uz+9a1DyFqVWZabtLIJX/lMgaEtiykZYmJ32sqV7Vo\n6B4w\r\n=ZKmB\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524865639981_1524865652749_0.46386093919220595"},"_hasShrinkwrap":false},"1.3.0-next.1524884685958":{"name":"puppeteer","version":"1.3.0-next.1524884685958","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"553380"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"a2a910024806be47157a3c491b6e63a387f1c79b","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.3.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524884685958","_shasum":"b84bc70f5507a67fc5d38e103e3cde94cae5d2d6","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"b84bc70f5507a67fc5d38e103e3cde94cae5d2d6","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524884685958.tgz","fileCount":31,"unpackedSize":258109,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa4+TZCRA9TVsSAnZWagAArDAP/iOat68EqGJRHHkpHO92\nnNy10MUWVaxI8WQ3Jw8RSf7p01er7P3hP7WJAkZcrZGPtt+F9xc+vP3Pkj/h\neibnPLaZ5gpMjz1/Xu0fmD26xGjG03LYizbOhaGwrC+6kG4GVLmf6yZSKBha\nCwMt17WpJT4jZCoMoQRhk/yMn4iWyTFJorilKlq1vXF5HOP+N9Fj4v43BNPN\nEyr7R+pqNG1kVnrKup0T8Vmz626gkfDGRWzGGSdRjUVKaGiQbhVt9OddjDC+\nRR6qNISa5BU3Z3SCZsdK4sVoeev0etZ97HyI6PTD+0c9lJrF/ednaF/LSY8j\nUAR3bOCnPgbekJB/nEtuSy87eFluOOVwMil5aH+LQUr2hhp5rfVfNyKnSosr\n+emLlr3OrY9rf2BvGqzxhHOHRh463ODfH1oA8a3yOGmNOl9JaqYNQ1ZGaPLz\nEuSXUiRVgRTd05+8n60+0giS+AWmJs8pi5KgcrjNY0fPNwImkJRufOdIJd6Y\nA41FdrK2NFA4/UkFP0SurT2Vl1/1Lx0XUAa8gt5Bn68onrhOylMqzwTQ6lyx\nFQLt60DktSrJw2PtNYeguCzzzw5xHLyaLMjZNWIOxcxDSA4fbrDj9G//7et2\nd2m6tSJLaGTNvmFw3YAIWdzIPnlZnXO9SWRr5Ciu6spa+F76A1JS1L4ZrMjy\nb2wt\r\n=4o6+\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524884685958_1524884697233_0.09296164603027668"},"_hasShrinkwrap":false},"1.3.0-next.1524889059564":{"name":"puppeteer","version":"1.3.0-next.1524889059564","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"553380"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"58c46680f37cd0b8fb0fa1805a6d79ad00464feb","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.3.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524889059564","_shasum":"9779b909bcf20fa63283afbca12c138192580a45","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"9779b909bcf20fa63283afbca12c138192580a45","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524889059564.tgz","fileCount":31,"unpackedSize":258238,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa4/XuCRA9TVsSAnZWagAAMUwQAJk7i1XAciIyx5zEDNo7\ndM5HXGv7ndVxeehN0vU/58SqTddA+fNzL65ha97mX+TEE6D4CcLGe2oteqrL\ngimKU5uDFqi5qLOpLikpscokdez9K3SPczx5LD0NSe6RBWCCvonX2Me6T1lq\ny8DwPg/J2pzQBa2QYqe6dgKRZeK8CrvAgCECtug5ggnBjII8dGCwBDrieDsN\nLWDfkMYvJPKwbD2sLcG5Y4BQuxTv8fLfMK522F5sVPJ6TQDupxIlGd57tR0E\n5M5cPGmylwEFHp6XAlzljG8bAkHQDbZoA/Xn5MHFlTZgBDXkDJfw3uRUO7eF\nHdZpyCOiVQJi1h+ZcnLMs3WJt8y6MZf3fb7vlG0Gd1X74angK9NbbFUSt5QM\nnLLScQzIn3MmI6PNmuBShIeFkppUjadLJ+/gBrD2SqL88rgS5AFaMXUzcG7x\nOsqrMlWjf15KkWZ+86ixooc7xrYKDF2ZHXTGSxZ0MMnp/3/+ZYS/3/+xgQyh\ntmXXbll4mgemXbvIxEc+sKdCTgKG3HUVDSLPqAJhZUEUeQvnvktJGnHgsJ7a\nFZ4Sqt3KQaJWpZr6fyP66p8/NdchDU07n3Im3yVSUGeFLdQZv+yV37M8Cf4h\nL+4MpNsi5oXB7yeRy0Q2MlQa09c4EQqy6dpiTQX2KBCczLMiyMme5i2g4ct6\neTMh\r\n=vXkV\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524889059564_1524889070373_0.10270086693138492"},"_hasShrinkwrap":false},"1.3.0-next.1524890531204":{"name":"puppeteer","version":"1.3.0-next.1524890531204","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"553380"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"e236887bbbd015e46fe036ef1caf957b52d70251","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.3.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1524890531204","_shasum":"253d34c24ef9b70f0ea5c1db41bd20a7c948091a","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"253d34c24ef9b70f0ea5c1db41bd20a7c948091a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1524890531204.tgz","fileCount":31,"unpackedSize":258577,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa4/uwCRA9TVsSAnZWagAA1V8P/ibwFwtZSCm1BWgpJSRy\noXr7H9M2YEcLtn8EDPeN6U1qZmUFB/iH2JFEcHnfG2rSgAupTuBrfxFRLa+4\nho1G8vXNOdQ/PssBNm4/L8D87tmB1VSesgPUQHLqF4geZbokS4QgA9i6E41b\nZh5XLaY/LGiWEQOiWla2TD7+BJPCy+1Mkk3VrC7F1wr2XysL0jZEZgdhpmBk\nNLIxcfKFG1HNIkcfJezFm4ISq63wWWplW/Y0hakcOLsAbMSncj1/tKuA8Ft4\n8sFAh6zqFtDbwKUtV3Lk1/k1p7voWXnRJO766hTNYOWtYq39zUhBO8K0KDQc\n2e+Ux65dUePndeKR5CAJ92nAv6K3SUJsJgRuRnQGRVAAwgO1XieV3n9kelFH\nD1jFCzhLMN9s6MwJWEuesZVZGzjGRRZXEDUd//B/EE9/tgb02k4ex/rLQJ+H\n9FMnRWHClU+GderKW3/PYJNKaiDYDpHS1GGCeGXJ3pH+yFv76s4Cz0zbXlYp\nSPEn07JGtx4u7idOsWn+ZKZ3QXBQw/WjjY0ttP2KDvBg4DN+gAi1rF8zYzKg\nULUKvKFEFSvfvPrptI7D6CgT93z8DdUjXowor7TeoXhOCTea+ibudtlvZaNg\n7Vx8+d8r54FyM5LK+0xUBwB9cDTEGU4FXgQ+1D2SIQzIjnwVuA4QEkBAkfkj\n6+JK\r\n=AGEF\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1524890531204_1524890543798_0.09497512570317901"},"_hasShrinkwrap":false},"1.3.0-next.1525111445523":{"name":"puppeteer","version":"1.3.0-next.1525111445523","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"553380"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"afee0104bef96f005088ae477b88acf0e9f5e8c1","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.3.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1525111445523","_shasum":"69ed39ec47990c616a6cf80c15f701e937eaec3f","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"69ed39ec47990c616a6cf80c15f701e937eaec3f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1525111445523.tgz","fileCount":31,"unpackedSize":259310,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa51qkCRA9TVsSAnZWagAAt4oQAJF2dITXBNrBkyvu7CL2\nq109Vd6aKPZEBdJZQALCSHbY0TToEODiGXkMY5wMSNFKtWi7Jz+wdEZBUtMn\nig1Or1xyZS4WRPCLBy98aLGbWPzcZ/f0dEH404W/gSFxkGQr+IgoQiowN8wg\naAGDsyBkUsvr0BxDhlhHuDvCH62K2wJQ0VpHo5twAXU/S69Ns5Dxh23liQIi\nIhdUeupuqJ/VO6L9RXi8LpwpDwEm1N2f2IBETbobK+9U5e4ppaN8bkxvwz+G\nUq640+SxV+lDEJk5r1udM1iXJPyJYS9MnN2NgMmwaZy0LCX+Uw2OpYW6zuzP\nmeBMjumREFNj9c4GKk7VS0mqEZZWH/EavcjywOg9Z4RXDaGELpGLBWqnGfaF\nqJvPC29TBGlRuBQU96vQocf+Y48+l/PpgyYh9UOZkmvPeNY60l52sd2aa4dQ\nj36u5LfOL8/Y700KXG2AU5SSNKuI5VCuhVLCLRFr8WQ3kLrHqRAehqt3P4YL\ntNMP4SWTLivPTL1LJKx6bQRQHn9NpFFTFKj46Xv8xU5WJWiY3bcFrzbkOSXX\nefMQ8zAUwTsVtJNh028y6Zt935U19YFm5rNXB+ldmkwv+SKX+6+MS7nRs7+W\nL1WCLOzVPa+ItBLJbvYPrMWZaz6n1PUiEsC2K6GXNaVYRhuofX72l9AZuvIM\nz2f6\r\n=Rnlz\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1525111445523_1525111460211_0.693517277196273"},"_hasShrinkwrap":false},"1.3.0-next.1525135284208":{"name":"puppeteer","version":"1.3.0-next.1525135284208","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"554716"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"376018854bcf91f2a7ca7c79a21d93daa6eac84a","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.3.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1525135284208","_shasum":"3a7ed35243103021e52cabe31abe0dbbf89fce4f","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"3a7ed35243103021e52cabe31abe0dbbf89fce4f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1525135284208.tgz","fileCount":31,"unpackedSize":259310,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa57fACRA9TVsSAnZWagAArPgP/RNG6om7h8Nm9Oti7Awx\n1He7di7BVIjfWupfTcR8biklqaXAahCMsXXvgpguiEmbEfpeiI4FtneXdEEt\nQdNacJVzh/Max7d9eHGOY1M5afLjNLUfZ75LfsZVxJvibvL+Z+GJbV4HsH+x\nqxZw4Sz8HfljwoTXRkTfk5qp3vS8ehh/KZs+jCF19l2b965ddzvEmQ/QNx0r\nM+OQjxdXgl4Qkb0xNXc6GjmNcKCoBKSQoBCPi6+7KyIOLLV4z/vzeqRi9dwF\n7ZxcPqLM6BWdlpGkhUFgsd+MtzHCgffFyAOefsj8VWw1btcgIqUqf97Nlke6\n1H2Y2l88OIO6XevRFeysjvgetcsphodkbFmvne8eeOEO3Gvd9CEfK8PCb4nM\n9Z448MogHRn/aWQoehhjwp+LLxc1zvEnNmM03jGJwQrw+sqVbFN97DVJWC9E\nFVRoYxOlv47H6b5To07QkRPALPa9YY0dehSMBsUvmqphl+9fWV6iTx1rERU8\n0msWHE1bZ6diSfhwgVdkZpsSvbIK2mEa5WWwSstSRdNWmmtDOAJ7PSlVLkfK\nfPQgDViA1Tc7dUFvtZa+f/Sin26FYQWpCtICWx4Gsv3Kw/C0Q1vORM5RHCvj\nkljj91Xb6yB5RrTbkSVmWfhx15+XMh8jpufS7Yg+X6vg5Jby0U6bQNpz2T/L\ny2rg\r\n=/hAn\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1525135284208_1525135295911_0.8348071361982412"},"_hasShrinkwrap":false},"1.3.0-next.1525301631811":{"name":"puppeteer","version":"1.3.0-next.1525301631811","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"554716"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"a310d57d847b008dba3b0772085840dde3343c64","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.3.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1525301631811","_shasum":"5a54c579047686dffad98fc61a29997f689ec2da","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"5a54c579047686dffad98fc61a29997f689ec2da","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1525301631811.tgz","fileCount":31,"unpackedSize":259573,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa6kGMCRA9TVsSAnZWagAAb2gP/34lwr/vzY9LbqmHSosz\nZHwyx4qX2W5DRMTSPpOBqjcRjXPHptwmJSuYKF6YIFEiKS0CrDtCC4XpSen4\nTwn5N6ohq+WUDW9suxXW6FZqgWqy7XGLXhDq0Rrd3WpQvYeHjTP7QLN9L0Hp\nuwBY/I/YXt+JFi8erO2hpEG2SfTLOuM6/3yuAI4n8m6fJCUcHVb96fern57h\noGC2zeb0A1guIPyVuXZl+EQv9xS4yJhRmRP+e2Etv2mzJZDKwPgePCvi6pFd\nuGM1i+PLUwRd0VmoCZugWsS4wsRTEw2DStNWLqhT8av4EkkJp9L3+SS5unkx\nI/AK24dv/gLjrDIokNdPAmNshsMO4vIDydwYaXXLE80Oy9oL5pqS6bp0v0vy\n7PSBKokGGmyDDTObysnPcxXgjBZ0N6hA7sNqI4w8Kl204d5CYVC8xDqIUsVd\nylHJYV8zxq/S/FClW3/P3PunZ/90BuWunfRJlUXFJPjesPsMri3n8SL3X5R+\nq68Go6dcLDoa15Wy91xX6BsRwZntV3vvGm5uhyNOx2h02tknpgCisgs7HU6X\noNodS0QVfXij63CZ4qsuQZdnEXkwvSxjOjI2d/JpMK6/do1cswo2j7YAGbFN\nruXR6q/NcWWjajydSdDb+KZZb1QI3qACYUmzZe7FsFXjXytafnJaSbvwjauz\nZqwf\r\n=cxHh\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1525301631811_1525301644323_0.5717761402973967"},"_hasShrinkwrap":false},"1.3.0-next.1525388744646":{"name":"puppeteer","version":"1.3.0-next.1525388744646","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"555668"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"1db4986d12fdcb6a81214f44721b2c0bff9369f3","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.3.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1525388744646","_shasum":"666c85a24ab776db95890d2dc2a7f9a24604f078","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"666c85a24ab776db95890d2dc2a7f9a24604f078","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1525388744646.tgz","fileCount":31,"unpackedSize":259573,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa65XUCRA9TVsSAnZWagAAjAsQAIbzNUbkZ6SpGSeLNJSY\nRWLiaN6GG+/9W9tmyHL4BSZEbBaK5xvOpiPPOMpM2nd/J6kctugPriWf67X6\neI8+UDa6y5ydx5/8b1wRQvfyCZvF9NRkR9CqGdkZkaSqPRNlogdAyRBjmi0n\nQza/0lyanaSG6cFh7jHapCO7lrLyWtyhJvbtNbBuAsgxJu1VoABEA1gefwi0\n7gTB1+YT6xZ1f4oiqXM0kCfkw0PFwXH7cO4iY3YjHlqHRzKD4y1bvxb1YfWK\nvn0ltRJ4rOT8DX6lMEOaiIxnAq+nDfMxizkSDgJzORE42eDQBplFkHhJCxXc\nEFYsChohRPPK+9njcnc/Zrv01WlnDsDXDFXNSG0BGZD0hXE3I0oC0X0+9Yl2\ny0HZDcVymBcNe/KMf2BMPYCQOR+AD9DofyyChJKuIrva6IIX1KuxvisyUei5\nz4p5KMZQ5ABY9pxoDPtaB9WZfVHdHOEMjJQxzJTRzruro/IgIBcf/Pc9c1cJ\nCXSNQBIPZhgi8pqygVz9qIKp+gNvxtK+KN+X/evqTwN0O9FO+hMoxZBhJ+oA\nut3mtgRPz9iDn+GYQ3nt0S8/JYl8KcJdPmA8mdy9vdVpBNohTx2kBnUue/+0\ngz72PluygY3ESOa0wALbl26yqoEkzjjkC95BR9rOQtm4iSndl0xTb1d6sjLY\nZjYJ\r\n=Kgfl\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1525388744646_1525388756356_0.8843785712044632"},"_hasShrinkwrap":false},"1.3.0-next.1525459650281":{"name":"puppeteer","version":"1.3.0-next.1525459650281","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"555668"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"1d225cfa17086ccfb9bd403f8eb3623255d54cca","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.3.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1525459650281","_shasum":"80fb1e5df734fb6ac4fda7b5c28ed0aaff921414","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"80fb1e5df734fb6ac4fda7b5c28ed0aaff921414","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1525459650281.tgz","fileCount":31,"unpackedSize":259664,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa7KrPCRA9TVsSAnZWagAA/8sP/2H5EYL3Iol0nThg56qT\ndl5UUka2GLYEnnMLQl/50lpFmOGlCiglwGQvIM8MiQ8zZJZwJirKDton/XuK\nKbcSmqCNGkpmhzNQilPqCwAanf5YAMg5rbSXGp2ZZVyvoLZd9/l4HUUwUp93\nYxVIW3w95Ybt0UvQiADlxFvEnNdJ7h9RaCEGfNp3tzObhGX4PayTSn21CzRd\nLmHPi742U1p7HW8Ak3ivIcPCwCX627EUAEHGSHLXDcJvclQlUD22XIPT0loq\nE6O8jIzgtStgVme/0T67U1iIiKkz5qcYZxAxoskSam+CYlqc1iscGPxwplqd\nzDoeYwMLvgj8i0+vF+nk+HtqxbYIoS3FBL0MdTIZrqZxlNPGf4bRH+Jwj1Jp\n0H88q6MvKIcSVAg0Q1eRC/WJ/vVCJfk+sRP9v6XYY/GbJvmVtp3/2TUE1OF1\n0vY+z1V5pOvqQ3/heu7EK7w6Y46xtrc5+V0ZHhc8r/MBLsNBLFJ1qAS3Vq51\nlkLBBWcOoVtOAX+NZ0Nv66gJht2TIHq/YVdGXb38YEQ7qYrkokEMNwG/mHYu\n/INp+uNQipulZTaCIWRIeXSqhv/A4+e+8MTiJF+VaM/+fCTO6B3hnfin5vJ1\nD6Vb3uH9W3kmpTpoQa1hTL0fmzadN5SmCjTTMewov+zrtQbLu/OVYC6m5+Ik\nf4g2\r\n=heW/\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1525459650281_1525459661963_0.5136312765544584"},"_hasShrinkwrap":false},"1.3.0-next.1525828826075":{"name":"puppeteer","version":"1.3.0-next.1525828826075","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"555668"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"88b996877fd83514cc5c2bedee7b817db9a0eb79","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.3.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.3.0-next.1525828826075","_shasum":"c500bcd6480c7839d91b6c951b76b1b4273d2795","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"c500bcd6480c7839d91b6c951b76b1b4273d2795","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.3.0-next.1525828826075.tgz","fileCount":31,"unpackedSize":260032,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa8kznCRA9TVsSAnZWagAAmXcP/2clXZtK6QVSKNfHJYS3\n51jpNQxlWtbl1XL39q+U98bkCxZKmRWeEONyxFhI3R+200zC8VMePwT2bE7X\nXygJ9CfV5gDCjkCW+7uhnPO5kKdv+hbDQcMcRHxSg9WbzqVL7WhhbOZOLKN3\nbt91QeARjWMqQUD/QI/2cVEJpwoEoLM98i8cxt4MJaJR2ikzWcZjm/tgvaSa\nIP82oESVnjINbAldvGhcYx/Fi8muKOjNV5Orhu81djdFpdk8KaJFgWgoASfX\nbZhnqLe91XASAjuLfsOw3u1mnMfFifQE0NOzrTykVPWurTvfGUJ+xvYl9VYM\nlxWocL9KhRClG+yI/SRGVocsEEufIHTquSjjg4evnc/ry2eX+Ic/GqBBtNZV\nmpq0zMsCU4T/ImXrRGAxZD5lt6UIn66DO8PyRmogyYzAd+1k5jekng+DZb2D\nhdL7WQAD1tWTeENl/d3ZrL84Xto9k/fh3aIMFd+uUmIlllSlKZCjA4xVJqw2\nDoACLPNK2MqXPE/479qN3LvRC2usLp0+VNPmgt4ohdDzhLMkf2u7TBzp0Fuz\n3NF6iJh4wfbNdAImVocDKXAhCusUY+HmjSUAY2KP/izUR+Y8+t71Vscw6ez5\nHH+ym+ydBAA/lqw+HEdJs+Vvv9buAC1ZY+6Cwjn9CUfQlSJsQ/mRCmpr9ImQ\nrqzO\r\n=t35X\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.3.0-next.1525828826075_1525828839640_0.959199372458055"},"_hasShrinkwrap":false},"1.4.0-next.1525841345569":{"name":"puppeteer","version":"1.4.0-next.1525841345569","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"555668"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"808bf8e5582482a1d849ff22a51e52024810905c","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1525841345569","_shasum":"b993f81763194ad6afb96293d7924ab67ce4601d","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"b993f81763194ad6afb96293d7924ab67ce4601d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1525841345569.tgz","fileCount":31,"unpackedSize":260032,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa8n3NCRA9TVsSAnZWagAAyuQP/AtjqiYX7qmqoG1IO60/\nbjJ9yMBmpVemKqhK5DqxGKlHTKgctCQmL0GXF7XqsASJBMInsb329WIOHtDB\niqok4+3VPBJjwGs8/y8yisjJ+MNhYuwyCV9MGwNOzxjF2qUZGxxKgRGg1tYj\nUnvvT0t+XrTeC96uAimdVfJjXZfWEp8R94EBL0mLOOM8Ov+lli6v16rrQy91\n91CvQXCJscqcPBRUl0SGOCNVSixpgzQgQ1eWF9oRbuGSAjpywt828VevefGL\nOHFeR9P3KFhBub0OQt49O70iIAIF65Cga6TynonLYB3ZnhAUv2zgaXgJ0TFZ\nvZsSPqkHEh1q16Mwi5VPNTY+P/WHykudyxl+ssDsu/et0dw/End8v1kAdTdG\nSnkVgZ92m1KhoKKyoIFosmsOVpXy6rQeRftCbXDgraj3U+VtdAYMYzm0S1dN\n22bkPLs+cj3ucGo6BgewQEy68j0tb59fTR/Vx4Vt025i/nK48HGnDk09+K7Z\nIX9YM5FwHuqwtkQ9izCneajmA0dMo2stiBCoo8XZi77npBJ7RKcC4i/Mh9z6\nYh9MmQ5LYnOlg+G2jhdsu2nSIl28xInXlyZIN/oqtzeE9BXXHchmKv+zVxRF\ncUxnRub1e0vyg5uFgdY4zha6juD5oliq6nreNRLggiaZj9sqjkkdVvAQXyFf\n+npe\r\n=81Ni\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1525841345569_1525841357289_0.881273117876008"},"_hasShrinkwrap":false},"1.4.0":{"name":"puppeteer","version":"1.4.0","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"555668"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"808bf8e5582482a1d849ff22a51e52024810905c","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.4.0","_npmVersion":"6.0.0","_nodeVersion":"8.9.4","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-WDnC1FSHTedvRSS8BZB73tPAx2svUCWFdcxVjrybw8pbKOAB1v5S/pW0EamkqQoL1mXiBc+v8lyYjhhzMHIk1Q==","shasum":"437f0f3450d76e437185c0bf06f446e80f184692","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0.tgz","fileCount":52,"unpackedSize":549854,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa8oPACRA9TVsSAnZWagAA1JAP/0PcmnAIcNydRkhHZ+JK\n+PSZuhpT6OF+HdHPR64fBOfsEmnnPaXf/CN0Y7RtCOyK1UOMK2FvIrKpaee4\n8N8SnFlbbexX0PmNHC+F8eaPaEl2CIrJvjfYOgOtwPaMKLGQlqdOpCHsA/bs\n6ZUY2qVrw+JyQsA4rYrH+U0NRShDgKmReDyL9X5iqNYjSJ3VY0kNrXIXYm3m\nFzN7wuRAKVDTh9wB+Q/oZEJ4J4k01pcMWEMbp3uGp+sclrvfMnKeIeV/3INQ\nPTX0foBBVv3gusq+wxVSB8N1cPB0AOE18gbYTmBkSjIQfvBvIfMB0pgR+dQF\ngGNojmlhePEtZQW1dr56+Qc0nu6FG61V+0P8DWnD3ytcmSzEsHjJkUMzYLwI\nAFE+HlBaSuVSlAuR9tw962wn7Ph8B4ApmrlFbC2m/3VB6E+rzmWdvOUoYrLN\nWdSTanU9vxAuFwaXCeju4PrCHHWNx2CoVGmIVYShWdwgXyRow7QTkLihhhXl\nUsJaPVMDMXCATYpY2dUm1EZzNwc3xxfnQLoNlmFPEBSldmugzzZoYR/KktT6\npEYrL1xOJRp2uGYBoSnzM3d42dM9TDo5fRUcoR7dWQ812QmGBVgx4EoLdPtb\n9kS2CUfR9bJpzksZ9kY0tsSs9rClSfDlyp9iTGWqHkLwxS2qTVH9klh/KYXY\n6CAq\r\n=KBLP\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0_1525842879740_0.6434763578124978"},"_hasShrinkwrap":false},"1.4.0-next.1525875866798":{"name":"puppeteer","version":"1.4.0-next.1525875866798","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"555668"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"d02440d1eac98028e29f4e1cf55413062a259156","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1525875866798","_shasum":"35e2f02710d348238c4ff8aeda8d35c60e52a67f","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"35e2f02710d348238c4ff8aeda8d35c60e52a67f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1525875866798.tgz","fileCount":31,"unpackedSize":260032,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa8wSnCRA9TVsSAnZWagAACs0P/2AIa2aPu2Y73sOLzrMe\ne4GhrCxBHDmkCRuowFwtWhitXCi1NzoOpsiyoolm38b5GyzWkgp+6h2QNgOj\nOqVa9DbB2F7CNPpe3h0+OQpUweWaekfPnJHWF6H2GSf7UKLwWzzvGzKPQ/q8\noWiDhBRIgT4ylK0KJcLVCKlyARJeXPF065EjvPwclFBuCorqRWArKgEkw7i6\nlERrEqfbvjr6LJwea4O2OONQYnzfYiaWW/P3afSqsxhyi8cCkLJ2hcjkuD6X\nlJMZDed1Eu5k4FMWt0yQlBXmpLx2gGN6yOj0MH3JzBNETdcBGEXfCn1IuXH8\ncm8wcGV5jY7takS4HkDgtvu3Myxay+sZr52BtuSKM0zGJTdbPLR9yNPWMJif\n+9cb348SqdZq7sqUJUFdfaxS1ijk8kVKhf6RN1HY1o40wMwYe6oZVXU8Gr1D\n6Q8l2nrUpov5jp1jz1ZWGLyLdQdAYCSN90CrDS+62qcTbd20wR7Z7b1f1I2U\nohhL9af51zhTbY5Uey+UKKbfUZkTEJved4DDr0a5oPbZ9KQEid4WzFRTbzqP\nFFVoG2v+fumyY/1QMtsj2qoso5IPFa+0/gLygdwXzhgq//O7IWoW7/cTqleD\nuDj5QrFO03lCBZ8p+Ar3i2qNwXL43TiXfx7xbzQs6ZeFnQbzPvpxCCm8fPnC\n8mcJ\r\n=NPsc\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1525875866798_1525875879439_0.13942436362371113"},"_hasShrinkwrap":false},"1.4.0-next.1525886024469":{"name":"puppeteer","version":"1.4.0-next.1525886024469","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"58c672b1314aaadd0f01c6bf644b8a9cec5b40c2","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1525886024469","_shasum":"b41cc1e39e04847d586d3c754f38ec3bcdbeb8c1","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"b41cc1e39e04847d586d3c754f38ec3bcdbeb8c1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1525886024469.tgz","fileCount":31,"unpackedSize":260032,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa8yxUCRA9TVsSAnZWagAALCUP/i6O6mL/tJy9WgM+3MLd\nd+AGUw2PwXtFoUzpmpwksLBKevvoLThKiKh6aJvJInLNAQD/3AcG0eosoLMU\nvnZDO1iYdQGSXSLEXp4DWUhoeDfSV75JITZ055LmPFwDg1ScEMwWdPgpGVPj\nAqAyee0kxZWZitD1q6MjAVt4VH+nS+oVlniUBV+ebMbhpebU6bTWVhK5Ui8x\nysVyJAv/CHPKQZgdI5Oj+SGJJsIPx8hnOzUh6/eF8gbZ2/+cGAtALt3IqWIG\n40gnzCMuZaaxIY8ojg/aE8n1IXWJrOL5uiZmqWecdQfz1rA7uGSvLEsfAs6m\nrLfcWQsErpn9aneKQaK+hNwcxplljvHO+tio/2+qdfuJZfndW3fNxjIkDE+m\nmq0/U3VqippoL6UVgJwGHh/0lKt9SF/tRFF9f9WHdxCAEl3eIVStVizhtksj\nvqGmhkUAVNokWtGH34u1lIpQz/jGJzGQc0PaPYM+03Wy7u2XIs7VonfEpcy2\nUgKMLZK2LYfmAEXnQFxIeQqV9c0WOpDcd4k2GkTRfz9AlaBEN06qG5XoZLYK\nrvkm1uo6Z57gfKcqR+2Oa6HGHlMkNn7iw6dFkzYzpqyspNv3t+mrwJp4+SSH\noM5N1j3Un77a9IFmNffswHlAu9Pyfuyq/toK0QMopRMDJBnSqiYVhTqaupF1\niVJV\r\n=vMZL\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1525886024469_1525886035837_0.09906185429199788"},"_hasShrinkwrap":false},"1.4.0-next.1525984104919":{"name":"puppeteer","version":"1.4.0-next.1525984104919","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"3b03ff65c7b369debfcaa67a8673fba105a2d20d","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1525984104919","_shasum":"a62c589b3fa9330096535a575923a87ff32db1a9","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"a62c589b3fa9330096535a575923a87ff32db1a9","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1525984104919.tgz","fileCount":31,"unpackedSize":263106,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa9Kt0CRA9TVsSAnZWagAA630P/A4ENavJm+1esyNAvDAM\n8RU/9jnZUnuYM4wsWe5/32Q777wNQJ9xvFn2O/XEtzEP8lA8ey4fBpsndzIO\nt6YUGrGh8XfFsiafxyTYAHaVk8rWRjm21KmYwT0VttzVVZO+6dIQsIEfe/43\nKudQCZN3+M0Nlsbwn3v0R71b/H8RJ9AEdSTKZWdcXs0LnSAeDmf5Kl18HpSu\n2eWrIfc/8iyWuEyz86WfOFXU5jxxZoTH4FEjnohwS2uLOqZgqVQUT7YSWMav\nLVTjg3Ndo7sYTgMWkDpyc3ETrOZuJaxvUZjD2z/Ae+bFdqhYee0mut25eBVe\nwoSn7B1xjfstO5AUoSeTgqI9amFjSygCoTBnarT/YEjBliLyX7TwjSlcKp/G\nBrDjRUwHlHK3PUUZwQypwSXdcW87RM4weLrd7c+sXom9OF44o5YivXfFU8Z9\nZ+6h/diXXyFLz4Vg1RzVJcnQUIC5/kQEyHw2l429cWNenp8xjDOHtJ35TSDD\navDHbESduTSsji2SEvuJ3erMoQY4+a1xjtmvLSBoE1obI4wLcGGgEeDFuxPR\nbXJ/G4xyydbFRc7/IbG0BPOqZwNj+/QA4knGoUvJmzZq+6LcQ4TaNjircWWU\ny5nrbOiZNAV5DBdNy14waYbF8LF/vhGM63T/aNDYXyE9JHJFINzjf3dNoZ36\njQCi\r\n=duww\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1525984104919_1525984115421_0.0644930195740856"},"_hasShrinkwrap":false},"1.4.0-next.1526506763480":{"name":"puppeteer","version":"1.4.0-next.1526506763480","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"23d25a6e1231bde9cc8d0bdc2145fbc1e4b008c6","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1526506763480","_shasum":"3db94c733c16a5b306dd4bf4823341ec8e2fed21","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"3db94c733c16a5b306dd4bf4823341ec8e2fed21","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1526506763480.tgz","fileCount":31,"unpackedSize":263154,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa/KUXCRA9TVsSAnZWagAAxY4QAIDbzoaSckipAM8abV+l\nqLO25FUv9cvWGHGSpP6M9l8J9ni66cwyOPHqq1LFh1DUpiy1C2gxbYbqsrDk\ngWGpMGOjenDr3Yh3/es49KCO0oH2oNaJNWMU82T34pFcgMIkSKqdgWNwHS9o\ny4nm3N/fG9kslqt1KmXaKX36/YSBMEZazCR4R67EZi3MfHoNTKCgfbYdZaFw\nf87/qSNwF1qAqRpTyMTWtfSP29wdRJZihlFdrc6kz7xLHNJa4nT+vpyYGEvg\n9o+1GAFc0M90F2uUpWhej/PPaJGNbgotl61rrIrxg0Q/Uedkbger4mzkQydC\nA/tPXqgN4zbw3pj/U3RXUZ2Df5OFVWa2wcoTqtaZF91RNyCptBBt7G6WveQp\n71RwWkzyuUdkRfUSD7AAFH/3+jaX7KJaaTnFn0ArZFha9C3cwHZiPbzI75Bl\nWUqmM1DdLYzgLRYz0tK2bgZ00OdpiVJ5ZG5muOy/+AxJ9COzH9leJ5pbWPbd\n9PjZLA/BSfCPHoOVY7uVlb0YOLII5kYNRtaDM6EU7knD6F6OJuP67Fkv1hQx\nKm1WmCSXlB71R4xvr7M3sgBaSwAPop+ZGQGqrTKAxX3gme9R3WpDUzEjATVt\njSgy8xlJRKBU0/m/Ed2FoT6xSD/ZOff/bduP9sJhLZRluuSih5MWOF7DDcdk\nn4o6\r\n=+f6H\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1526506763480_1526506775408_0.821695562586988"},"_hasShrinkwrap":false},"1.4.0-next.1526506897747":{"name":"puppeteer","version":"1.4.0-next.1526506897747","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.1.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"1c4a8f0bbbbd5ad6102cc52012819c91ca8565e6","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1526506897747","_shasum":"f5d69b279ecbd3fc5e65ea419777774114b52204","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"f5d69b279ecbd3fc5e65ea419777774114b52204","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1526506897747.tgz","fileCount":31,"unpackedSize":263078,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa/KWgCRA9TVsSAnZWagAABQEQAJYx5PUwZwlR5sUcZDb6\nGw9xNw62pMDlbhFjVYH8VcaUoHJX4O05/q8OEbe24n2AElbCjycVhq2F1NRt\nTAVh7sAdpVLbWDFUPhOEvtQrdNk194mOQy2N/pp3FzVG2LzUGa0pHhYsdpZT\nU1HRop735g0VtJkiAxoEa3fTySSaZqba6FPglaFdkgJ3VmH0ttxJ0AI+sAJ4\nL9Q6Gci0Utk2BFQqLwDYcOXfgaZQDXdAs4QDmZ1ZkuirxJ2tWgbiU/Q68/SK\np/EIithzRuOa0H8+DUZc8cKycfHvMBTFApCjB6eMBJrCnPITmaEEp34zUPqg\nclfmT0gydP1zIyU1Qvki5xG1J6PpC1W/6pyp228Nb2zJ+NCKo9os7u1D/hPh\nkpiMqgzD4U5gTdqXB8JlfMm7PYXS1U0CmPKRnjYTAOE7gDxJj6hjiFKabiwd\nOHVp43RSD0H25/2dIOZRPiBS/5fU3g/fSeJhqh6nVUnLuIzYybHCk16/OtSp\nBb7w3mItOj99MQuuGpi0vwcOl1ethXDcBFo1chiI0V1gvGVtHOoeNrTcdBM+\nCmziJ6OD+LidxLlYTdumuo+05jif6iXjb6myk6ePu6uYUWoyxA/3mkXYlBWm\nelpH4xIVxNNhExyMk6Pgmkk7BwOvlhueokAnNKwlKIBsfSOaEis2aaMt+u8O\n16J5\r\n=fg/D\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1526506897747_1526506912127_0.03821785970508618"},"_hasShrinkwrap":false},"1.4.0-next.1526507871161":{"name":"puppeteer","version":"1.4.0-next.1526507871161","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.5","https-proxy-agent":"^2.1.0","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^3.0.0"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.0.0","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"de82b87cfa1c637787a09b90266318905ae16f42","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1526507871161","_shasum":"0b74620d3fbb3a7d50d0c9290d0e226ca5b7339e","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"0b74620d3fbb3a7d50d0c9290d0e226ca5b7339e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1526507871161.tgz","fileCount":31,"unpackedSize":263101,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa/KlsCRA9TVsSAnZWagAAqwMP+wWNH3Ov6H+tbu+ArHzB\nzHdmmpaHonamZazmbJBLP/20L9eWz1b9nuh0tFEvpzx9lcGEMa6VHEFe36jA\nQm/nGMjH2hSLLtdW7h/9tLMoqtKOq0qOdYO0MI7dLIxUkBYQW0mPbW4oprqu\nHaPpNZEv2jGFEzaXUPoKGHXsYGjYLNAK2Y6IrAlm2MgEZZ73JQZYKBZWTYXK\nYpfaIfOxdy7g/PfgPe8QOKhr+qXnuMbmXB2+6zxN8lzLKVx3tXAK6w7o5GrG\nmTeyBntOxOAXeMT+4XYGxbCGSatyKUjWTPWbdifMj6kkR5pQHNqeTvupXhrS\n3/PDkcZQU3nwTcbJEoU7UUKQIRUCuujrOw11QuF/BpKFNh+vIwSYJoOTtlxH\ni1y1DTWQQ6MfmFrc49OM7H4MGAOJVZFFYlRJuV2VCTCPeTApX0EElYAEP4p/\nIo8ls9GfNg6bEr3AjV62fkWpAU+YSaM1pKu7ZkgF6nrCRyc045GbdPNZBT2B\nNWYU6lRoX7SX6AoG27Fuw3jzCdYl0Fciw5epWiVqheNv77Z2pKCV3cOh0Yxb\n5Vn3r/XePOl7MkQwfHNVSFMJRhAQg36ae2ylHPUedC2/Fvfo34QTK8rBihbS\n1GGiSk2j/YDqWbqbnYriL7NYSC1PReGL9a+zp2NAXsD7tmetwkg1rpZSom14\n6G5s\r\n=ocHA\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1526507871161_1526507884518_0.8038771244044178"},"_hasShrinkwrap":false},"1.4.0-next.1526510342960":{"name":"puppeteer","version":"1.4.0-next.1526510342960","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"2d82e0891afdc3e8e836e2edcf8261e276fa49f3","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1526510342960","_shasum":"e6bbd9513b29a0d07ad0d8d89820a1773d7e0e16","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"e6bbd9513b29a0d07ad0d8d89820a1773d7e0e16","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1526510342960.tgz","fileCount":31,"unpackedSize":263102,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa/LMSCRA9TVsSAnZWagAAGHkP/R2l+3YU50SyRlkHlQ5A\nM4q1kW2ttAg2mWwFZElAgbUcRiz8EJqez/kEo9izr6GZHY4v9+SdhCAMAyZT\nYsFqMX9Ho9+T01TfOY1y4g86IR95dfOxX0Aaf3gsJd0RlfrVrD3WctmLBuKB\nqV7giLxITrula5httcH4gyE3PTvtG4g5H4XeCLX0Ke9GCTnOcnLVBucZa3ey\nodgXWkXOoqr957HkFlypqyWwaL0Vno1scM8g+bqD5OzQBYkKchTY67M2oyR2\nz8OZM6dgfoAicSjpcmPRpfCh62CRwIheGpD0AO7kESb81zA12RhX+N/PQ8Y4\nZr+A9+g53tDf6HEVLv9Mbg3h1JQehEMIeyHLCqdvMQTliE69os4f1+8f8db6\nZNIww0SrukWIz07uQc/+i1Pm6sJSaykmAjR+3qkqSwyjX4SVoX9z5q+oiEGk\nepdkj18M+A8ZQNJ7ebzyfROTWeyoegtUOPrPLRQr5ccLUetwvl6kcZemUgZ1\nQy5yPuAMswAZCI5KSGxTfkPut4R6FzEA/wGIFmMzOuAFlKFCPatU+NplFrpS\nr/pbwBkj3Z/8pqu95yt1VIGF81HttYS0ap0Eqjx4XGDPJJUtWGauoSoQGiDT\n14ktTcRNxrQBke559Q72S6NiWdJ+5URfQ/s42JxiRPLiu/4F7V7AgL5CrJ/W\nbOj9\r\n=v6KO\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1526510342960_1526510354634_0.9056840965537343"},"_hasShrinkwrap":false},"1.4.0-next.1526519544088":{"name":"puppeteer","version":"1.4.0-next.1526519544088","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"51645932b7dc3c3f3d958deb667c22b3519bcc91","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1526519544088","_shasum":"41a391fa50cc53ab8d119c3a27772a58394b7b1a","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"41a391fa50cc53ab8d119c3a27772a58394b7b1a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1526519544088.tgz","fileCount":31,"unpackedSize":263492,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa/NcDCRA9TVsSAnZWagAAzN8P/3cdRukNMJMBsnCGg6BT\nnZWmmB+yIUM+BvHvq5o4nMpXG07mzOJNXBDrepskHK+zL1z+eXtC80Lwl8MJ\nhndMGkZhsTHaxQfjwDedLXlMbB0vUGrbHcNWIySCg1AxESsRMEAMFfyovoAN\n7YF+PKeUlzwfRFoOGualSmGWkJh4ursLOCIhbrnajx8uwVdkAUJq5pkp5Ee0\nUxWSKx2pDONgjHcFuU0jStI9RHlRGJKxNgJnjGwJmZV8WkKK0n7rv374JhlI\n8pnraLXPw8XFVyI5m4Wt50osTOyFwGI5mkb6hNNN7ZdMr5rsJlhxTVpUY8sZ\nacg6w8lItT9/wBUG2eXCDsGSgNz/Z8+80K8XqNY/FJ5H5rkCArNkGKfp3IgJ\nxmEfZqg6j24TmS905FCoLMbvBbzTbnzDdq95LF9FpG1++FX+DG8v1NuP7hBM\nl6fnTpsV9Epecvn0cWmXecXK4eekI5dwg0jPp4Fk2U+UCmxTj8K+kHj8sb5G\n8keK8n52q8gwycUTjywhvXkhO7vapKCwWXRWqrMuZTtsSnPMeGdbYReMwRS2\nTGTxWLIvy33Jp9z2/Ts/Qx3YWJ7O5fVKzhc9aGaOhJbVB7OScv7GGrP5bqBn\neLwg255xM/PnrjMIpo+w4UVfwGDqtOijG00XxWpbljK8Ls3FGFAi1eQBjiEH\nLLG1\r\n=mjgW\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1526519544088_1526519555592_0.11218415154403294"},"_hasShrinkwrap":false},"1.4.0-next.1526593919447":{"name":"puppeteer","version":"1.4.0-next.1526593919447","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"2d9e5a0d25006c0b43fa03f5449c85d2c1bc8604","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1526593919447","_shasum":"5fc24e52e088d6e1bf972b848482f14d70bf0eea","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"5fc24e52e088d6e1bf972b848482f14d70bf0eea","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1526593919447.tgz","fileCount":31,"unpackedSize":263492,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa/fmwCRA9TVsSAnZWagAAr1wP/RN5HY/hyGExLy0FEXQ2\nh41XVir7AxEp+06lOpvAMr5ZynaLvij3ErMngrWk1+Phtp/JGUxf5gKl6Lgb\npY/BJWXfCcIDfrt6PLWhbmzugjFRlJLlTDK4a9nvfPYpJ4a3yiI/xX0AtSrw\n/4QqWH1gbYvm+/EFxvLI4HKA5B1eZO7tsxZoUr54LvBtNHuXyx1B0+YcEClx\n566AjRKhBT3M/V6IVePmAOakou6Xg3dHNLoU8nqlWdFWXB5GQIOpKKIN0orQ\nrf2kL2F6xVre2+mHnbvA1JEBGmitDC5SepQXsvno5eyXsQfaDSDK79aPA5DM\nIeJq1q6hEGnInIYuVVyzq/5E2+tTzdNJRjisoOjDIftFtwscK0M8i/TT7uyl\ng2c+fJqAXU3T/GUbk/T770J2hkR2N3h+QibGh7GZfIGltx9qjcw3F3+qu6ao\nLof9JmhbehKLtWqcf2YcXQWkFiAE6VH7/qBPGhFwrh7cZht+wuixMmWqF1AS\nVr7JFqyUIEu1URXMB2I4vIjAyg/ZUGxHz8y4HviVpcCLA7xecgoF/t/yILN2\nscKqcTJJzY7dESfHRA8Q3dvCj/ae7K8kSL1ob1mwquyXHvpjwtl5j1j4vD1U\n3UBSqf7wShzLjqRrgjKDWSYe4NGG2fs0Y3J0eSqbawggQuG7FrLxo42Il0Q0\nPYBM\r\n=Jt7Q\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1526593919447_1526593968035_0.6525931850910842"},"_hasShrinkwrap":false},"1.4.0-next.1526933481310":{"name":"puppeteer","version":"1.4.0-next.1526933481310","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"b474f2ce871e094c792bb3d24281ff45ec6a8987","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1526933481310","_shasum":"01436198be1367fbc0b2d95f2197547f82d8490c","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"01436198be1367fbc0b2d95f2197547f82d8490c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1526933481310.tgz","fileCount":31,"unpackedSize":263492,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbAyf2CRA9TVsSAnZWagAAfOkP/3RqcliI3baApDsxk7ju\nxqfG4HtvAO36AHOEwkagLSfG+HUEVlr1e7mMcTZreqpqN5PkMRPfnbA1Pffj\npXKs+pZ2SuQofvqPMf14s2w4h99G2zQcGf4jh4yMkSils8TCGv7cCMUyIhwi\nlPoShA1C2UQnhpuixtpkK4zqAsBHMrUGoUO6RLMwfBBDzYz8hk4BAw4o75wV\nhUBZnGQPPK79RFABxFeZzdvfAM+OFrMWHmK8zTC11sYG2/rh259aC6F+qICT\nkRDXFhVhN0SApFLpsRanM2cKmfJ7agX71QzzPSxjxsQE/J91I2+2kn16Ptd+\nAusZ3jJ6tE4eo79+MKjs3tkeOyd5cKWVwfhAoyKQrQtEy5JrjzlmjENzEzGH\nrz8RBbaDLZXccmWGDkYcCig4qXB4iyXLndqWn3A1ysnH6lGtrpc7uBTAt1d9\ndv90LVV/x4f+nPsL9lF4zbOoJLkQ+rABLBv4U/orrcC/RGUp7hn03p1P7CX5\nP0dXNkqyI9i3gnaa70PbC5ZE4xPdxehhytU/k42AAwtNQFtOE9LKCj76Fc4D\nf3Hoy0Hc1zE2VWNsgxW1MafYfJIi94S5cDB7lMhcHl1h7dVqRE86JovH0dmp\neptPVchM0BURlOj93ZKb6pGTrihiuPBSrH5U4aAKccWZbHvQgBYPDj4tRC8X\nAQmE\r\n=QwAZ\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1526933481310_1526933493999_0.6999080248296476"},"_hasShrinkwrap":false},"1.4.0-next.1526938425001":{"name":"puppeteer","version":"1.4.0-next.1526938425001","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"93fe2b57d69d99bce037420422bbd7bee92471d3","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1526938425001","_shasum":"85a447ab4822465ae421fbd412a0ce9fdb5e3242","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"85a447ab4822465ae421fbd412a0ce9fdb5e3242","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1526938425001.tgz","fileCount":32,"unpackedSize":267736,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbAztJCRA9TVsSAnZWagAA4WYQAI42CHvIMN94aTtvmnvp\nwZDKKkmRxZO8HxLw3zK4/xGOu3ElwYjw5ii0E7jYVuW8+g+lnd7EszFZJzZB\nN/AOeJNYARnLvm4E+okaHnQFL+I1F5Tq9Xjg+f3M2Y2ILwk8U3H7rSjimp2s\nlp9ohyIqPXQBhn02z9gLRs9AQQ6nGZTu0mZ4RjERiN5iNidXf7fxYmhuiARA\no15Jaqh90zhjPBXAPQeiBVBH+GfOaIJTYvHQrsnJDk1GZ+NTT1D23l/g3lPZ\nhRm90P6ZpIa+YSLiSZLgTgo/uqtCEDzo3phJU6WI26rSerNtbPlmp3k+9pcU\np4x2GrxUNZhFLBl2fzQjavZQbJnlOYOcHxKaqp2PyPBKNJMHppsPvar9R+r5\nx39rG26DEOjGqclhb5FF9KU6xpojw7QQZtvAuxxg7Hnnewu53McytGiqjI9f\nejVbw3mhV7HO/AExxnoA5R9jA6rp6mcJthu1b04i3JiQIY7a/WKBJpjNd2Cb\nd69jgHUfYGkh8mo5gEjFeo9xq/qTs/Xek7NDmYwCAkTr/PaQOQQNxtMs32iJ\n+0sVSmx2nqCMqOPkQb43UcKwsdCf3S8UabtY0UZok8r8gkpg1bSti0M86jzb\n4yiXJgU+mAf6mN88Qn5bdgtEIg4KDOwM97eXW7qa6ECw+euJJIkmNer871cg\nVwML\r\n=c8Io\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1526938425001_1526938441484_0.759668684222983"},"_hasShrinkwrap":false},"1.4.0-next.1526938802806":{"name":"puppeteer","version":"1.4.0-next.1526938802806","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"17bc6515deec8229afb73edc3869f497e6c06e10","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1526938802806","_shasum":"0f926b36a7a23bf43cb64eadeb55b5cb8206c6ae","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"0f926b36a7a23bf43cb64eadeb55b5cb8206c6ae","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1526938802806.tgz","fileCount":32,"unpackedSize":267736,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbAzzACRA9TVsSAnZWagAAPP8P/0Hntp+QzUyag4jmel2I\nD2I2OC/wDlqZHGZRQFDsCLboaMGiFAFBsRafmzqoMiJz/fe0+YYL69zUGSSH\nSswdPcDhJF8WpHiXiCuojv4BnjbbBgqTd/oR8jEgAPkrVTUGkT6NP+ueRf61\nVdsHxKHPZVdCBcPuji474YQ8tOJIClWbbtI9+/cvN+ieqNzvv8VQQCamHAco\nweeD0pvmA8s66K3Mg0tMBfWu5mvJySQQ642lMWpLc9M5YfBqe9HcBva6deA8\nYTQpV+pVadSDBPv9smXRCUCMF1FP5SZAE2Gie5ccDqSXR7NkE8bXX2scr25b\ndyPOf/XyRVpk34aDeIB7gBae/07Duh0Ju3fJRwTvtqLKXgqM5FU3TfCu86Uu\n1AmpE+DaMBMbCkXq6+SGB3OJIMdS3vif9wtWG3BNYlLR+HxZWIMSc0Nh2K/e\newk7iOZ7fyZDxLkZquLe22GcbgVokkdItBnehQ1inqeD3EhyflqlvSKydgUM\nr7Cp5FDF2kmKUziUc3CJjyOcI7dvA1lu8XaH+WQGr1hofozjZopfAOIw78la\nr79yHXkOnnUND3e/k+Lp9vIho36t8BaI21ZCYEtwLlFvGOawCAFPgtFWYInC\nVF6WArqdEeIH2ziBYl105/LTbxngEDA0cjlF1tJbduLjg9hNnpmQfDyLC+yt\nmR0X\r\n=yRJJ\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1526938802806_1526938816438_0.11957587384019064"},"_hasShrinkwrap":false},"1.4.0-next.1527292051776":{"name":"puppeteer","version":"1.4.0-next.1527292051776","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"6a0627a4119991c95d134fc4aeeecb2e1d2b5baa","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527292051776","_shasum":"7cb5324fe342bb2dcb2f92425520015c5435b2f4","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"7cb5324fe342bb2dcb2f92425520015c5435b2f4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527292051776.tgz","fileCount":32,"unpackedSize":267837,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbCKClCRA9TVsSAnZWagAA5q4P/2U2rvP14/qHx/HdOaOG\nnFEX573SPipMeDh9PubhQgj37NAEXPdntbpjHFkcK+nVBHv72K7zPmRJt61x\nbzexdY0wAwXHAjWuwUrXb3qx6NN66KngOmtQbrO5cxE1sGyNjtnxNtbngV8t\nyRvwQBOakyq94+Rca2pHQkSWAsSn90fYpISHwk5kDeu6DNNpRdu4VFu1UxgQ\nx0WwssUmbIOJKGFZQ9aS3G5uh9/PZnQP+Rs1k2ZsV8fNGqHTLfk32GHc5GbP\ntrqWSUwp3Q9Ri1Eb+xoriGsfcyxuEP1gRKSXuu8mAnQ4UgCNrQhxH1hI8rUR\n1W/enNLgJTY0BFepLmjKedjAWzaj/b0p38GzVwJw2jBlspIgufqbrcNgbxZS\nMHH7sM6SNpk+5hvqi3LTOQtPbFq7RjrtF+70ANj2h4i0mLj9V5dlMMCHf3qf\nbFzatw9ccqGjs+i78Whn/NGswBjOsSpVkicQxlRJypnUQTdyjpAjO1CREPPD\nXHxz++c79+NzcvtVK3uMRvXDAW3I0X2+7pnNVv/akGucHFA0qb6XYKXv2JfO\n4Ri7+juM4x8rLrTCdWXbHcRvk+U6YPkuaQ1TgJ2pnXDW9ft4niYfMjWlQCd6\n695cIK6ztfHVm5cUcaD+0qKMEFjaNIJ+OHxsmuRNwMhxDsMk+Ivi7KdcRI1t\nDjJ6\r\n=H0NX\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527292051776_1527292068845_0.769682702979267"},"_hasShrinkwrap":false},"1.4.0-next.1527292060831":{"name":"puppeteer","version":"1.4.0-next.1527292060831","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"debfe7e0b135f790971e1ea73f0a8edea23e0df8","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527292060831","_shasum":"9c634c4b9af4fdf05ef98ad562246e9afe9f0753","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"9c634c4b9af4fdf05ef98ad562246e9afe9f0753","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527292060831.tgz","fileCount":32,"unpackedSize":267854,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbCKCtCRA9TVsSAnZWagAAUGoQAJ49xo2Ux0X7b26EihOZ\nLFQbllTvtER3MrjjjUAMiQWEkMTPYpss5fmKrhL82FqHQxK4NDJVjJt8YJrP\nSoiw+kAkqqHimFtQxqnpKPPkd70keIDBGBPegNK6al0zLoipiB23TmxpKjif\n/T+ztPOWIX6n/wLDEy7Ry/+kebYd7jkVdbPJJNqqUrz4PA965GgabtONiT9w\noORM+f4N6JsqdzCF0F46kCmtjC9k5nw76yehryjY4hghITzcRc3HBhgKVg9k\ngstMXRDor4G5CrankE6oBw2u9+P2I+wqm9HZiphLlJsT+Sl9fGn3xv/6p2FQ\ng3lKq1R+zpVyPJ695t+Qt5Uwr7b/MUgcWAuyrz4PgdQTd70VfohxNxczQxIU\nk2CvtD+RQf1Pluuw3IbLLGdw7ZH7SEfTqIMfHS2PHgUyRmhX1AQJh9l/oRJK\n63kgrumzi5zShWag6Nakj/PgrYTyLh6uVZa/Pift64iB1oTesIptrzrCdxB5\nvuu+KBEP2rCbTFx4D2MWJNQi3dE5o/8fW/LhnmBJheDVqK/YCbYbeQKeYk3r\nr2SU0P8auF6mKyidkvA2SSe89CSNxS/PDp+KvoIyUdypUNBz3BgUxKPdyozm\nTjHndcMqz9sg3H+zVYda7v11JCcnocFQ84yChF3MC/jz9RPPMutAMcfKvmRK\ni6gx\r\n=Bfq2\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527292060831_1527292077410_0.9689190240124774"},"_hasShrinkwrap":false},"1.4.0-next.1527292169142":{"name":"puppeteer","version":"1.4.0-next.1527292169142","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"b522ecaa6547f4ade70e6a336c0ebb147b8e9a84","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527292169142","_shasum":"26dae090953eb658cbe2d022f16e086cfb5c3f1d","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"26dae090953eb658cbe2d022f16e086cfb5c3f1d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527292169142.tgz","fileCount":32,"unpackedSize":267854,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbCKEVCRA9TVsSAnZWagAA44EP/0N+NNg7Oop8eOkTk9W5\nocBUC2lI5BEO/04WC/qNNAd2QRoUiXh4CkULXs9pPMWrK4sYbkEOrryQmMpt\nEgRLNuW1JDUMcmdf4TG+0EeADMi+FnCUKcwXbhDsdBlQIomzEXUxUGc7N4DO\nTInIamLQU/hq1pD5TLK4x8xPaJPfaD61rhcMOSLlPawyGsvsTDirkEursrzh\nptXf7BapJV3zM8/ECqus/OdPL7/YuZtaPrcMotjagBjvWkCFl1/ZE+cCvsb1\n7cShfynGTR/oJ7i/ynK1E9B/7AOa72ZpzuHbYhzhPAwZGNhy+JiVM1okrxeO\nOqg9UBYoADDc4yIKdOhIbbnflG4OjazxNfRT8iKp05u13x4i/Ydz/ypwbacI\npM3ph1GiwmI/4RiL1mOqOeUrNcMuXcZf9XeT5W9uamwnaeH8XtsyP144c68L\noYPKtQd0/OuTVoWQk2zjLspgAGLOzeDKjK62DAPl5cfw4/zI1kIRiUauLNpR\n2F7YTzEl0BlhSjN3kGHvNTsq4cYW/UyO+VW8aacEfY50mGEA8skWJStW0z1A\np2PQlOWJqCcfY+i6pp8gGW0hAmKJ3Vx7WD1f0lbbIdIt/w6dTFTPdQkhFh2E\ny3nWbZld+Ek0YLYEgnlNh0Wkn1cYgr0wIFme1sqffI1h2DmhfNNjizKfqOAr\nsVQT\r\n=vdBs\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527292169142_1527292181604_0.7533317822967305"},"_hasShrinkwrap":false},"1.4.0-next.1527292577308":{"name":"puppeteer","version":"1.4.0-next.1527292577308","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"32f4c173c818a023d8ae24ecde78c5f3fc57a0c1","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527292577308","_shasum":"a0c79f862e4402b2f6475ad6490b015ab4fa34c4","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"a0c79f862e4402b2f6475ad6490b015ab4fa34c4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527292577308.tgz","fileCount":32,"unpackedSize":268002,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbCKKtCRA9TVsSAnZWagAAbwQP/07VS2qP5lxKrYKR2Y2Q\nfJLU7hUQtPnxAUEcd+egK2WaSW5SpjDizEPIWKckLTMIm70e59bxJQBKH7G8\nxO78Nfa2BPTkWLLdYBbelyOpfAakquRc6JIl9v3Y37t8oa5NQPdylmwPGnKw\nMLbQeps5NSa5XbZdjcThEvgnNO2caEuW3o8LYvzHe88HeAY5rik3CIfGeIee\nvWfxmfOG3KFLLbczP+4/llh6XlA0QraVvjS/wmri9lZVstwxfBBQn+keV5fA\nCac3ek+tP0d7a8ZiujvMJfiwzRG+C68AJ4VQaaY6Q+t4zHlW4RHq159VRdRv\nZidDepo02llSYQbTuvaOtiq2lORJD5TGf/qvb9jtr0fr1gloAq0KOoxzYsLm\nnhTeIxZtZ7ebVlHvU3dst+u3Dhn1z+2DUh+H2AebDkviDxg+Dy8mYI3ebPJa\ns5bHjdsMm+dheYFc9ZfzbQLac5nS1ozZop83utqnQBzsyVfToA4m8nDmrtJC\nHfzLPTSJ2znnB7Nu2arMhxHfGBrm8sira25EmxF7GsH3X1Q50zmssfYM2dWT\n9lLnlMjEdbZvyDWuDzb1TmZkiC4LC9ayATMmpRfG6HBIPgaY1pykd6NwXLB3\nc+5zH/Ie/cY8ysw/sTTYJdSzVAbz7DruHkTOGeySMM/v7hgTImWLO4N07lzF\nT1gA\r\n=T9TQ\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527292577308_1527292589597_0.4939200282588143"},"_hasShrinkwrap":false},"1.4.0-next.1527292742969":{"name":"puppeteer","version":"1.4.0-next.1527292742969","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"1e07925e26783d586ab63a6eb88063ca51fb5647","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527292742969","_shasum":"7089da748afd4363040a0787da8f9ee2c386ca44","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"7089da748afd4363040a0787da8f9ee2c386ca44","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527292742969.tgz","fileCount":32,"unpackedSize":268517,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbCKNVCRA9TVsSAnZWagAAalAP/iiUMNhKka6IuCaJiFQN\nQlacFaPTN0iVOBCCRGogGTdymVi+Ytsf1Quebes43w+J2Eudjn4kwuF7X/l8\n8Q64rZAZdSMH6YpPEdd8B9eti2viY48vfq51mUDsA1wJsT4UzYARpggFoxQj\nZG0s+T57OXua5Hk9cEM0tsH6X3Rsy8QAUmdp0XZdXN+0ChklzHnCOCBjfIpf\nCZesEO4Q49mU1nOQCFkqvo6Mf1lBqZXQ0+ldh6YbPgaRXxEs2fWSa9ZBMEvT\naYXs3RrLflBEm1YHPpjAqo+tjNvSeL/DxnPyQRVHNdOE+tpwY6JkocAZqXyv\nw6N2ZzCnm1JXkh3H32VZVnhfXVGFUlI/kKFPAAeOmkaFeQk/YLW0/ByjHBZP\nSoMv3YIiLrll58f2OZzwwV/5Ef6h7smabHxWCCkLM+zZygKuNmJyucmUqDoT\nwmhwT6MnirOYE179L8nam7Vdhie/Si74CDB94F8NMoTDbddTRViZetEourcK\nQa3Eaw5yCRnEV1RMg56bDE/BTzfzMgArXhx1mXDO1JGOfo207TcKjXqwQeMC\nkkrJmoVqg+FigV+0x3cs+R6oRO2hee14s5dOJhE5dNG8+JasNspHrSCYYUyY\nG/oQdgxf5EsMLTzh8JijeIJyEQVjdJbEaU2/atxlDni5/uKKZg6sMlvtWeSA\ns+ZR\r\n=X0Re\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527292742969_1527292757642_0.5316531866939751"},"_hasShrinkwrap":false},"1.4.0-next.1527294524156":{"name":"puppeteer","version":"1.4.0-next.1527294524156","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"b8df8bdf4a1ecd3768cf7edf6b920814daedb904","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527294524156","_shasum":"efdd1356986ea1d7cdab4fe1a66aecde5183c561","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"efdd1356986ea1d7cdab4fe1a66aecde5183c561","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527294524156.tgz","fileCount":32,"unpackedSize":268678,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbCKpHCRA9TVsSAnZWagAAgI8P/3iChwPx7SD0m509Wu68\nSKv8ouVoexZRjZ0R9vB1pKWp1KP8rVa9Q5GwShBhBNwFMyOjC9ozfu3mPw2V\nMPNrDxywjCyUdCLoFOQYavUlzlzoYHrTFrLJ5eyp+HQwRZJ3AuiVxrqxKtWc\nh5mkdyls/U2ncI/fY7KUioDVkupmx7TNbmPTS7GPBUHcm2ZwY0SopDl8E9WC\n5lMffBpFWPEHQ1BJ22Tvzx1GIAuoCipKYWrcXYWzApl0ugiYS0zBQpynhiDC\nJuYeE8vBXU84R2wkrN24wqPlMZDk8zBj7VXsum4uHWegoegficqudNcJiQ6F\n/X73oO7aJa1Kze4BnhpWXoLIGXqlvdX4irTND5nRXfAUq6dmQUQn334PWVr3\n72pbaAA1WYPmL+b3bT7CiZsjILRETSkFtET01fj4eX+1tpHkLPAFlVArTyt9\nuEBmRmUsM6eM8vtsVZ130M6cSobiER1H4nHZmCR2Ac3qAtAIqpAi0Omxnf+n\nRvGwkNq+PxoJeweFdfa4gn23OAGsrknR++eXqBq+KMpa1ECjrdQHJIRi07SO\n+Ri+QL+Wy0/7IQIU+XrTTBObMCwCfqN1geci2P6wBkg3ZerUVbO9+pSI8ayk\nbe0KSFYnD6ZbXWTlJtYVxWWJY7pm1Ylvcah7D/zRgBvlNwr7lQg/c+NUDVw3\nf4R3\r\n=/v1N\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527294524156_1527294535795_0.3252454898384374"},"_hasShrinkwrap":false},"1.4.0-next.1527294631387":{"name":"puppeteer","version":"1.4.0-next.1527294631387","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"f6393d876e98e39c6e4b0c36dead24034a15d3a5","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527294631387","_shasum":"a682a4aca39f1da0accdc56ff500291b573bcdb1","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"a682a4aca39f1da0accdc56ff500291b573bcdb1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527294631387.tgz","fileCount":32,"unpackedSize":268678,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbCKqzCRA9TVsSAnZWagAAB0kP/2iIxN9rVSxs1IoMXPus\n1h8POgyGF0lcjVbmFYrJP1/H0ERz7bX12Qqmuh5A4ZzDxyWCpq7Vbq1eJbcP\nm0uzESm84zkJkFsImlLfux1rOExiUNXPkFtfwsycwmPmDqcJqH2OyKLJRjbE\n/fUZ8HHgdLmxyPxtfD28A8TYP3PY6UYosAIv47M3yHy3ujx67J6ggooxsscb\nbwvqr45fxVcuQgbGhs2xF+yOsdsdeXID0kPB86xyTjCtCMV8U3g8XZlZUDIP\nRoCGa8XqLLQ4p43h6iABtAjm1z1pfaF8aA69s7eSGz8XcDS9/4YpyFhGptIT\nOOo0xEILbwXLcUOGYdW4PTYzw+VD7Xed6Rc+JNE5j9Y141e/u5mXatctjc48\npzMhbRo8zqqeoDTOwy9gXbQCx+f3JjfyVUzj6dreI/ecB+j/fHROl9a2QNj1\nY6X6cjpKNN3Z3N39k3VVsEl/7UWgI7XAvpQirOvQKdfNtO/mqk46R7aeh1wU\nvUQGGEHvK1FPX1/RIBoZNNg8ASE7FtSdOGgFDMrHT6OImObPVLQJGIeIhycj\n2H3FdQavqKjIsA8Aa1Fje0kxy7js0sviVBeNpUtelEvCw8idGEE1NlfRHM56\nmlFFxWiV1WKQqaqAtBnrtK2YBiTK8wslcofBxA2y+qxpI+HNb/7AsRXOScAU\nB4HD\r\n=sGCu\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527294631387_1527294643394_0.1707862368274511"},"_hasShrinkwrap":false},"1.4.0-next.1527294674237":{"name":"puppeteer","version":"1.4.0-next.1527294674237","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"node utils/protocol-types-generator && tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"7d64d40d6686d2af34c81b3128528a6a274b8037","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527294674237","_shasum":"59be1e0213e1d1bbcce2458fc8bdb258edadf1bb","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"59be1e0213e1d1bbcce2458fc8bdb258edadf1bb","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527294674237.tgz","fileCount":32,"unpackedSize":268647,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbCKreCRA9TVsSAnZWagAABXUP/R34gbt2atvbXBwho2Ju\nXT3SrB4jqEgI4K+Pkj1CZKsGzg47Jrl9+8urtQIk/7wMrs5ZvVza7gKaQpOR\n2oDHpRXXp/DpfobwKgodftVrJObZacFQIWXxgwD2xJ2jr/wNKtl60F4+McRZ\nxFlL1aTQRLpew2n1qn+VwIPMpJBfEjrjIeGF8N8WSFkmWLvgNvFK8M2APNtt\nYqSRXAunKGQ8/t7APOQEYDlYOj1nIICQIWVCbPqn0ecBZkKKeZzEi+0D85qd\nVXHPQTtADXSmvW/N0a6UWB3BYpd/ptf85j/jPSPTO2+IRW8qAGVlh5c0o84p\nqmPsaywFroKZktIboH8cWVHbs9UC9L6DGsMu+4hIdH15AXxGtDOFohvLRb0y\nBxuhBKrSMHRX5xUSEBZbPC+S5mMJkX4x0V4mZiehlD/5WDsLGPkCbW85fDW3\nuu9LQOvwc318AFSiqHNmwiNENN1SPAs9g+uBjSDk9FNnjqEcqM1/TeBbAexF\nTjv+yokhDMCVO2MiCnJ0SAFJeitiU99aFTM1ZWxx1eoW5RK8XeD9uAEqv8zB\nPyhk+B5yUCyJa2EzmvWhBE7bojI1uPKJweW7qV3aA+KWbiNd1JbiZ/8UkOBi\n69t0fyk/FhWukQTCEFCvt/JN51GC8cCZex/x4lin48foPP6/hpIz8QpAoPrw\nd0uN\r\n=uwnr\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527294674237_1527294686214_0.8899848462379507"},"_hasShrinkwrap":false},"1.4.0-next.1527632813414":{"name":"puppeteer","version":"1.4.0-next.1527632813414","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"5ff67dbdfe1589dca82250e799e12ba95cbd53b8","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527632813414","_shasum":"b4e235a372f661ff0560633785d3680cec9fdcfd","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"b4e235a372f661ff0560633785d3680cec9fdcfd","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527632813414.tgz","fileCount":32,"unpackedSize":269152,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbDdO6CRA9TVsSAnZWagAAkmAP+wc0rfDUVxdPu1Ll4iVn\n+5qaTxD2RoqzU5ClnGPhzXTGW+wO1bSPlR3N07eAaUojZ/wwdEZ/xhKLkhLO\na7Zh5eCYcmlzzEK15kocG7vQ9uijiNGBEbw2QnAuuuy/EOLB5HDJ9p0EhXG7\nngWlaw30hv4TYCQ5raohlcZYnZdEmozamJ8PhXuC/TT5BfiXjsgsXQfF6Nd3\naqL+bO+brEh38D8ISICNlWoTjLtS+piOivmW6uENwNCXnMx600WmkBXgo/EX\nfEN3I9cVNf7O3NXdj9WLBG876U45Ns8B+ARBJYTMcw0ccCk7k/AZozRH1hWu\nYKY3Gx3yb0dr0LtlqlZdbA6bsneVPWupSu/TJA1VxYOSmmPsOqedNo7RQ8R/\ne6WGNpN5VfzgOH3F0g5aqhEqhG+0KEhAvm8nL4x4quEMU/ftblaarWi8CnDx\nKRUzw5TM1MghNGI2b+WDVs2lAKfJq0M6Ns9WTr4K5TsKb8S149zlEvK1rmAs\nSdh67pR0jWFzrrwsl0ynFWwdDhj2jxilIp3BLBzN55gVYQDG9tURidCG660c\n6xT65i3a3P4HiQ1s+c00a/I3yJcl4ewyeqYXeF+lD7eE+YLzaJub7nO6T9WK\no5U3gCgJsEuqWnBZ8gpzm/plOlq7jdPD2bO6CMQUNEoRdMToFdD6nKkkBio8\ng6Cu\r\n=4MUc\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527632813414_1527632826471_0.6126230984234862"},"_hasShrinkwrap":false},"1.4.0-next.1527632860155":{"name":"puppeteer","version":"1.4.0-next.1527632860155","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"41ccd0bded807059864a1b67a2b1f363f03722ad","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527632860155","_shasum":"4f8a2ae9e9f8ed9f6201e0cb6f2dd83b4a046669","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"4f8a2ae9e9f8ed9f6201e0cb6f2dd83b4a046669","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527632860155.tgz","fileCount":32,"unpackedSize":269186,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbDdPqCRA9TVsSAnZWagAAsNAP/0ortu5W/sSd4/8MWvPQ\nwTLeHbWQlbF+G3YijDl3P2/cNyEQ4DB8hJBV8YW4lbEhSfngWofEX9szVzAI\nj0clXMFM6M3VU7w6ZGU7ps99aCvRshWH5OlfNEIf+Km+kgLAyH0llyp8ZHOh\nz2S+1Zg1I+JZo9R6d+JQfV0+JhiFKUJSZJgUYgkddi6Y2Lvj6fYEjb8pgt0m\nhnfzAQHjBfDGSbcrNVbiF61uhZvffAP6Os0QN0SqSJK1UmwZS2Wz/MYL/tXH\nMNi4kIG8fcc/QRyiqdGkt8VnlEnkV19toRNbK3Yj2Z+rZcU/0+QLuPWE/HIp\nASmaseMWNGRM2rev/2B9NqK3uRcz91wDAhNT4K5LJtwcwJJ7hiccEuNDbz2C\n5AAOWWwEzVl4ccR5Id478dobku/yyf+lvuMC8ApJgT3AzqcbvoP4f1bUbFWy\nNMdiF5jYF+P5KZSy69+fAHEi/jbaVu/ftggp0IBdHHbCRJDQTyEByw7kPhAJ\nDDIh8JoubTQzyzJXHxtT2FfS8ru0ZHLku8HrMwSo7UhPChdgxAsVoBk4tv7L\ny4gdEFBEX/7pv9C4JUE55wxzG7Y8n6uIMv5c+HCHU9O+GeYnAQiiLN972DVz\n176rrtNN3rHP4i+Qq6rpAc6heRr02aqHO7NpNcOc2UO/RamG5M9APWkeF8DV\nXtnJ\r\n=II8q\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527632860155_1527632874486_0.2532749119974067"},"_hasShrinkwrap":false},"1.4.0-next.1527633150048":{"name":"puppeteer","version":"1.4.0-next.1527633150048","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"8e12d197a2211fbf9394dec83abc05c679778ab8","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527633150048","_shasum":"df9dd1080b57ef9909b26e4a292b48f75c8eedcf","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"df9dd1080b57ef9909b26e4a292b48f75c8eedcf","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527633150048.tgz","fileCount":32,"unpackedSize":269186,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbDdUJCRA9TVsSAnZWagAA1LoP/i/cbuBVScwSY51FbJc4\nxaQjDaoXWEJWiTCJ/IWuEjBSh86MZzs0/LVwXoRTQdrIVKwPTHni/GyPWobh\nylm0iujphRbqlUMuNv3DvR771rSStLmU5a0+L9u3shiiQsF9tp40NUxTTnVg\nuc9aRR6qfIL2i1KBn31uzceX2QS2T/t0qsEK5aj7ESW0u/mFlReAEGYDTbCM\nUUQzY8RhgdWddCSG7fditboUtQCRotvbvq8UYIKApTbcuL5g71jnSsFOiU3t\nG/a2H0VLTJYYE8e1rYNmLSv9Q1zVJX+JLOg40j4+LQxx8jZd4v3utuk73jHB\nOYKHa+FmfTdXUGXd9595Aw7L6HweKPdL7yePyT1dL0kCM+IDnd6/XaLGRJ8D\nmZxAhBgbnYsjZ4FL2W4UulscYtgZo8UyPr8Lz/v0JwAapw4eJXYwkMgDG/Or\nBBhDdVOBtOU1tjzjNWew5N26F3Q5b2IXZ5dzUFYl1KYtwdDrGI/IFT3qDn9k\ndyx/kSjjDoGmGoybLMwkkENs+LxPp+DZZgVWU8LYYFOt4o/NUdIslRtLxUKN\nvPZLOm7E4xAB/XYnXLeHxsDBaM7+P9R86Tm79MQvRaJsTE9bc32hNnmSmZFf\nbajjsy4hR8nI6DzqZyUcQIVEFCcfSvR+isXWw6ghRaasr6BrnDzjZ/9vN23e\nF8rM\r\n=RK0Z\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527633150048_1527633161665_0.9905921115738168"},"_hasShrinkwrap":false},"1.4.0-next.1527634039615":{"name":"puppeteer","version":"1.4.0-next.1527634039615","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"1bbd094624f24aaac674b2491131828f29166c7b","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527634039615","_shasum":"08c4cb61284d2176a1dcaf6f845e03ef0fbb5391","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"08c4cb61284d2176a1dcaf6f845e03ef0fbb5391","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527634039615.tgz","fileCount":32,"unpackedSize":269186,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbDdiCCRA9TVsSAnZWagAA2bcP/iwa5izkuUT6qrzuj4hl\n+SiOOX9EBnsTaNne6ilJh6OXskSBeblui7Ik7XDpgFk+7s3Zlot0g66u4suh\nlQWef2zATF9CuXyiD6gh6McYlut4FuQz60v47+nR1YJYGCyP4DaWlBwSRbyV\nobKYg4wpbVUOpYxNYtAsSOPZtKUOdnxD1CgzsfFGdP2EN3YUxPEct8lgQT57\nAAsj4HLoDJorzE4F0XZUoIc44posZnz9fRpa0O5pFTEdMVy9RHA8V79aEo9v\nvFNyrUCAml17U4eW59roF6KiUDhEgJ6w0uF3dQ2czL63ewk4rvx/kxC2Q1sm\n5zEJGg1N2rWBB4XcH4hoiYXzVev6ZP7HoCT+6M/5rU+bUtjYJBT+W+91uF9U\nxdmcPPWSvRd3I4WBV7cebS5ohIYnWySZIBfk3afNYj4iWD+NmzU1bfv3dkvl\nVuicgoQdED9AjHHK3K4wbnsXrfPpDTQ07daEtfCG8LFvNl2nnmVvDYWp9w9e\n6dpiBWGo1cEcoLzp+Q3hqVfOagC4Dp8K1L9gTfjwvXD0vKit6EOJwmowQ+In\n+sXeCm//xqrqw4XE2W8HCcAsOryMMJM3VRR/109MJwAU2E7DOtNOxbK+gWRD\n1GnqoP2cGV3d/myDtzHpGnJIqU1gT7tkUkMQLJunCORX12+5UEcAOhMHaUXF\nPh5E\r\n=n5CL\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527634039615_1527634049961_0.269182124139957"},"_hasShrinkwrap":false},"1.4.0-next.1527715229660":{"name":"puppeteer","version":"1.4.0-next.1527715229660","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"e1c40bd776207d05b394eb7f7ca86de6be73f369","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527715229660","_shasum":"15e99d41219555b85b307d151fb5dedaec120186","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"15e99d41219555b85b307d151fb5dedaec120186","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527715229660.tgz","fileCount":32,"unpackedSize":269186,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbDxWtCRA9TVsSAnZWagAAVzYP/37pLBGs6euXgN6hy8an\nm7HDNtc+A6yn9JNRjxadufSFmElr+lrDx5bQxnw69Kw84eNPJCRU2iV7XNm0\nNA84Ca+PhP72LMZIkAvGoiq+A4ZxwHEiHXbU4Brr5tCzpaBoeU8v8tLNIN8v\nmM+7givA8zhVBXZXeC8461TiCpEVof5/rH1I4Idz7q7jNMWpADIMOj5xCVwP\nNSZ/0LuSCGWrc/154HlKgwYPm65LdP+LauVqDpAx9ANoz07UTQNIBt9cSujN\njjF7mviABfD/V7wkJps1S2D3E5YMs9UpkBPMjDTfVhxHkWfyTB6IHOhExsWB\n4b4pdNQsEqcyC91mE+505gTsB+eN9hgTpXU2BcLA8eIl7inVfRIKziNkVos7\nAHMBixbZpwjRx/BXCE9l/+lYflK9gnbsZrmHQ3w3CGCgqRkypRZhPB5Qs01k\nflkn/5YaqlibBMseRaocX8kDwRWu2350O2vHjgd8LXoiJ++ozFMA7huDkRGe\ns+oJCSSyAHW1PELkmq63vfpxxQMZruXnfBVWgX8cz1JM10rbhC/RnIbSKF/8\n0+po/ZuDPmBczUJ+LSTqY523lsHFpZzAYim8CxPpYgGTxoR4QZ40WhZaTWpx\nJaPkhhInsm+auwisra8LgsM0OpwnQg0ULatL7VQv7zfx4Jm1SKBgdq9/O1M6\nzii0\r\n=EiZV\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527715229660_1527715245336_0.8499806825021201"},"_hasShrinkwrap":false},"1.4.0-next.1527729038649":{"name":"puppeteer","version":"1.4.0-next.1527729038649","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"1c2adf61e971577a6bc96621fcb78ee88a9a9ff8","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527729038649","_shasum":"7b8262a76713da650acd47fcd0edeec9d2f4b865","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"7b8262a76713da650acd47fcd0edeec9d2f4b865","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527729038649.tgz","fileCount":32,"unpackedSize":269539,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbD0ubCRA9TVsSAnZWagAAxdkP/1ugDajCgSFcBN7eew+E\nzocA5RxRR8JH2NZ+qN1IH8vA6T+4gm+rREom8Er53vAhxLn3uC75mhIe5c1v\nq5X3nTSHmr0x/RAcbx8N6mnNHPnKiVEbfQu0SitP7L85FiboHrlsA6zyKm8Q\nK2wT3Q7OwsxDvvqhj3/qlcJEd5RuYzNdfhOtYJBlyAQ/S21zD9vAUpyW7zku\n+rXiirk3rYQHJQln0J0b40WYI1VVyoXxmga7gjtC6B7l3F2Y8kDMVGoMfVgu\n4vmCmqklkHXTKH31YLmNtYUX9jd7lzyxt3TaPWbqYffD+LqDVP7WBVCOU+Zr\n5gZVUtOKieiGnVDRsNCHSrU7pgHNvpbdZMKPnAcWE0gsMm/GpNJQJ2g/TDWr\nMTpVN66gj4aX4cw7qfbwzuopseqh5w80SDyqcskKNZ2uqN7GvrTcYnX2nYzv\ngh7v8c1/3ZD3DOGLCwLslcaXp+tgj4BzHLdrQzBOkl0+oYuSO8IO57kKuaFm\nIlHWTvDbH91aTdugYSDW7XOymAU6J5R8N6yyKujZW4AbEWh1D03BkSRfKVsF\no71F6MJ5XV//bxId5OVlZb65X+ZAhM1U2IoP4Ci2ZHAPr6ktlDW1FEIe2a/Z\na8h7hCEZVw482IdgUbc5XSkcIp9VQXgkFZfXBNLc+R1AsGUC1uDf9Fu7b+Cr\ne1CN\r\n=vV0D\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527729038649_1527729050421_0.1486758247480251"},"_hasShrinkwrap":false},"1.4.0-next.1527793846806":{"name":"puppeteer","version":"1.4.0-next.1527793846806","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","markdown-toc":"^1.2.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"14b51449238b09f20e3d2cdbb4578886276c5a9e","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527793846806","_shasum":"67822bbab0d2f7ce148abb088ec99cfa99f418c4","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"67822bbab0d2f7ce148abb088ec99cfa99f418c4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527793846806.tgz","fileCount":32,"unpackedSize":269539,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEEjFCRA9TVsSAnZWagAAIAwP/Agrtv+A+SuzzOQ8FXDi\nL0ALcaUhEuNNobLlexji/cPa3scmfw+PB1yt777CvKQUxI37FUwrq2GCa4oO\nW64Q7fGULMyJvB9+h+o/QGIs90P6Hb+FIZbAriz2IDwOoQfff1/TqJqmxPcJ\nXSz2nrEJzQXu6NX/9FBY3mkMUbUkFKXxGIbjWQus7XBTvz7qJ2+DW1f614/p\nv1swrR++8gBPdmSDLy4TQkr5i6muCmg0Uwtgm2NgQ1T8LmwjsyX15w+6Ok+i\nKcssRd8DyPHN7LNJLypAe3hNgPW+b4u9K3jfg9MC9Afsq42Yod4IyzaQUnwe\naNPWbO8VwFgjp+HV1I1nAcl1ngC1WGN2Y3n84kAzAzXHn6l55lGeDCDoE/m1\nmpyerHfsDsvVKet6eAAjtHnoNlNwfSDZRZFn03ra03gGHBeCgflsSzUAnORi\nACKSDupNzHtv2UCQGu4LT7bHyrWlrGNj7SNnwBbhe2qbr8hWvYbTq7bU4LZp\nhI+NONJX6TvIqHp/lwzPe9Mj9F8xtPYJJ5RTMAzkGLY+CQ1f+B2bJQLLHpBk\nFGIwbKGjiC2Afnk4Cx+5ZAfvZX0RrPjRkkLSnO2BgS/QvOemhVhqn1Y+RXdt\nRj1ZgdN9vpz1xTq1mO8AUaxvTXNEnmTAndZqD1ryl8dRAG7z/NvrDKahSfEZ\nJAH2\r\n=Wohp\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527793846806_1527793860817_0.6520769773522079"},"_hasShrinkwrap":false},"1.4.0-next.1527801882058":{"name":"puppeteer","version":"1.4.0-next.1527801882058","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"754df58d4e330f5e855d062c885a80005862af3b","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527801882058","_shasum":"03bdc2371be5cf12de400c9ba44610b0b65a33a1","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"03bdc2371be5cf12de400c9ba44610b0b65a33a1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527801882058.tgz","fileCount":32,"unpackedSize":269509,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEGgnCRA9TVsSAnZWagAAqQ4QAKS8frKUivgxTjZtEjiW\n3YL+yU0RGG2TaUO2yK2ZPGZm0Elnj1rvPYNIWrm6zctEy0DvCkiD9cvdf6oA\nFk3uTPanpAr7b+la1ByGQSAaJicwn/r7/SNLO9F+Hj5UhkUoH2gr3RsKd6yd\nINQqF3oxPLiMxamNgY00gRRDGHLlPXIPZy3ctAIczsBpPxSypIFU0TI6YM1g\naeOAmzZDWRCRhNoN2eilRGU/KoCfnssWnYXL3p/GMVl/t1unz4AZMmtXjnTl\nxx/dCgp/07ktKsVvGlmPkg8virF5mGyhWyysMfCRCb4Urk/zt4le1JfJZxmf\nQOPzI5ItdlKhHViY2M8PwEghFOlHHHGMp4UTSkVBDMYQRxyG7gKtZ+UE9Yc3\n/nOU1/SVlnph9uV+og2qiOpRVikLNUT5Q0A5yS3jWWZh1iQ+ZhWfpnzIA3xv\ndhEUe0E7rNJE6LLv1mUPTHeryUk9pZTq/WeeNsQ71046w6F5IgYBtjcQZOBL\nFOHJLonQ/ky3FWbyNN48g5A5HYvvPnQQ6jZJfOrmuFTxT+OpZF7lrZxiJIwk\nMt0fVT1ZorS9YJ5r9BPJ1+ymzmR7+NLZh/rPnvyORLc+pnP3Itd1ur7FexPn\nusLV5P6YGFfyqLCw6aZIBUMFfOYo9HOIxtAbPCx1zt+6kstKurRStT8MgS47\nKgI5\r\n=YDJK\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527801882058_1527801894945_0.0776975009955223"},"_hasShrinkwrap":false},"1.4.0-next.1527808033454":{"name":"puppeteer","version":"1.4.0-next.1527808033454","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"0ba72df67dc68cd28ee74f0fbd4d214ed26b31f8","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527808033454","_shasum":"33f7ee6ee92aa7bfd8c01714056e440228b4ceb8","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"33f7ee6ee92aa7bfd8c01714056e440228b4ceb8","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527808033454.tgz","fileCount":32,"unpackedSize":269509,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEIAwCRA9TVsSAnZWagAAP0AP/2HhTaOfmreFv8mB9VZj\n6/+KL4+syYwF38HmVr48XzZg1gZhfSGLuS18ps6UcakkueK938EQpPg7orev\nZqTa2kv3cGkPyW1nUbdrIH0VFbzBs7roofJyBiTZK0m5KwW3ldYDkpr7QmuB\nA4R2QQZQ16uorHltOib29YF7LyM8/gZAvK80Wo1b5xrb2ytpjAkeuXnHQ1Aq\nosuJI2U5wfXCaRpC8zH00ASxza+faOBNcBTkyBG/TGW95n1yAHN44GpapSI/\nSb0qsoSuhIRfMvKf2LyxrYxLjOTzg/8PlyLTJr19yeDfvxMfcDh2hNszvQHf\nhnYb74oaxgvQnEP3VRZhvKMqWINAy8CXwDcmXwDd8Rr7BgJH+KjLwhypJf6t\n6y/65oq+1D1uKj9PCu7oHk2TWmPoJSIVAHQSuh6Cuq+0SULPVfex9Cj1qKXF\nyViej2856q9aCczPgHnTi+gBKgVrAK0OUEX6dK/pR11WRUkGTkusNCR/9NXg\n4adWxBqm6UPIJgJB1VA5UPETlHPkta9+GOVt6bspn9m0Gwz8EQJ6dzZuGidC\nqLEhLKx1N9+kvXyKCU3vwGMm5gCVYRn2QH1hlLy2p3lO2JH/CL8p3qNs2nNZ\niVhi9RSkcmrn01uV/hUsm5emb1PE4iDrxzp8fQl9zyYCMWnKBLfasY3cY8Rz\nCv5d\r\n=0o+c\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527808033454_1527808048213_0.883342608726748"},"_hasShrinkwrap":false},"1.4.0-next.1527810120829":{"name":"puppeteer","version":"1.4.0-next.1527810120829","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"1c0ecc3d9cac9b4701b0d562fd1f3e0afcdaf4c5","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527810120829","_shasum":"8fdcf9f67f44f7d0a34e7846b69c33cc7fd3231d","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"8fdcf9f67f44f7d0a34e7846b69c33cc7fd3231d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527810120829.tgz","fileCount":32,"unpackedSize":269509,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEIhVCRA9TVsSAnZWagAAEzEP/1VZ/c2FvdFY3PDzNXxE\ngJIXUBAVX8Bo3Mn4LT37GVudYY9d2n95nosXJuoOESdphDb4pGFG5MMw3nDe\noUxLIyF3MQD2IPopAHwcV81l+yzaa5XewlUWscMxbxyy2DX56UiETrERgzsK\nD8XIcSRQiqzndNAwzOu+pFZTPWDJ9HqmbTeo/ulm1XhaMUBJtRlOGCV4DVCX\n2vCVUFiGH7TliqhwR/qiq5Sqpc/dOc23Q6cp8nh5uegKsIeOm4NP04eq+hLw\nmEv+r0mYW22nUdcHshspMUYQCGf1QzwkxdSMNnVq/AlDhE5vTLqkjzUxqB4b\nNRLJ0PzjKkqXIzLLBcZcRYVm6O37t623Fa3vzW8Ha/syoBI4wit23vyaJ6Y8\n3HSi2XBNUUenMogTI4ToNJoBjAhnbeJvzm0ppCADMdQ4NiLE1a6k0CdP2a7x\nBkIG3VXwkgpq9Lsemjc1Ana0Wa2OrpMKfEm7GqEjG0eS27eL1A3SCYHpVIxc\naovLa0N9wMhjPP1e+xsSqlpFw81tDjxFQFuPUFyZZLVoLhQsM0R+HeTNAl0B\ne9TCSpKv6TmyrK7ykssLj4dD1LGHdHfnWPEYFcn0cfGsyfQxaOlJmsVsf+6N\nfNtG7l8TsxWlT/vyiTYinHFkSWUcek3xi6yDttu+fSxTyiQBBJfxxSBtMn+e\nDpri\r\n=Ug5u\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527810120829_1527810133298_0.05816333027793741"},"_hasShrinkwrap":false},"1.4.0-next.1527810915859":{"name":"puppeteer","version":"1.4.0-next.1527810915859","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"35e3f12afaceb6f3b3d4ee6b7e7111e3f6dd941a","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527810915859","_shasum":"5e59df22bb99715d9e67f26a76d25bcc0625618e","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"5e59df22bb99715d9e67f26a76d25bcc0625618e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527810915859.tgz","fileCount":32,"unpackedSize":269527,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEItxCRA9TVsSAnZWagAAkGcP/35Jr7Sl37ZesUeBNrTL\n1qB3Ad2b8CxzSlMVyUWqtwnckA/Qi8B6eaZh0pRk42uY260h6aVWDiV4k9xr\nnR9ZCEr/y30l2u6HGwylbOWl1hOMLhARBqleBaoQhiqbYvxIvku3nxLlMbUj\nyj7BhJ6j/OIw0RNXRH7/rr7k6LJo6EscGF3G8AQdohqDBxV3WUk66tiDSEEb\nFOASAabjXAMy+/o99r6t6SA/NrPVdNftlVkEEKyPJkUDuigDNC751zoyHH5I\nJOwDHGQrLs38LAwW3dh46kk6u7ZHw1zEJPbETaf5wdyRkwDC12+VNF2CPt5u\nAS5Y5cusYFqPvl0ViCRntWHKjnaS66hdrChUpvjLqI0Ih6MQMrAUBwSag9BE\nJn7bBH0PmgeeuD3bKdB9vNK74o4Ng+5BJTq2SeaaFSMWaxUG81SmOY1t0V3Z\nZ9rKAv1gWylwAnaYftJkQDDzVBZ60YvCndeyXVDwCZeGGztLPVdEh9oWwnWx\njWU8Jm9CBRjdj2WWuJEdSIvGS8ZG+K57MFvtFBZKocuGQ75WAag/y0JLEUMB\nDu2sdDrROB6cITiPeDhRFzWZcwbrPZo5Vz5hPdfSeUhvHPnIluArSPXcGpfZ\njCvtS8EfaxJfKtFhlRbo3x0qk0dx3PbNu4DZwspGFndr0IHr8HbsMTKTQiqi\nRpZf\r\n=wxdT\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527810915859_1527810928743_0.4534108814535647"},"_hasShrinkwrap":false},"1.4.0-next.1527810967055":{"name":"puppeteer","version":"1.4.0-next.1527810967055","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"0b94fa70ebfedae31059eb5b982ff4337c3997b0","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527810967055","_shasum":"ebde51af3d480b58d8df93dde5e09f00decc022d","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"ebde51af3d480b58d8df93dde5e09f00decc022d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527810967055.tgz","fileCount":32,"unpackedSize":269274,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEIulCRA9TVsSAnZWagAAwzoQAKTVLAFJrjs8YerB6NIN\nUxQ1bk7KAHzIRTXkZdouIYdCfd9/a0aEJbv1fUHsAJak+O6qFm6n6r+RU1HU\nrsLimGAbJr6/83z0/loiAgAiXQjmwFktQO2jAUTwRaiDBq0r6omRYIuhrWyO\n0NAxPIwXf+alEOZXqNo+seNuXoviawzizfLO6ZTZJjTsKjlSOE7sXSJG7lFZ\nohpah/Mu4n/REFykD3NzaEjkH2AvxT9Cz8daUPLkdippIdCOc/DaiGJZ86js\nxohydKAjvGbOJxbLCxQud8a09WRTYXo/pCyGN4nmjf72r4gi6W9zE8wba3IB\noidfusYXTBismj89dwlJTtvKp1ZH7Uu7TGLq8UcyP525qjMebvOJDB1U+ulW\nobiMrcYHon/AGQ08ljaofl3QFv+A7la8IEFnxComsN+7I0XKX069PiltzrQc\nBOYUT1ftAgjbShTL9vCc5yhj80FnEI+1H5FRGrdCHP7n3BaPkf0Wm4T4voLT\nOcI1NB/tEQHSabIbSX59yv6WN5MJo418wTqeQ1rnIB5xRIM6ECLfx4P82Hb8\npeWSMGyPGV4E75Dt4tVN+zJ3T/5mBRpkUytlrXUSKQi3AwafgUkikjvktUlF\nJV2ZYp7eaJ16bXPTAEzXaCzn3DkOe+fFDfcZMpJhg0nG2Q06Wt4UTMwawM5P\nNNoK\r\n=3KE5\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527810967055_1527810980865_0.5611093252988351"},"_hasShrinkwrap":false},"1.4.0-next.1527811743681":{"name":"puppeteer","version":"1.4.0-next.1527811743681","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"f6356683cdcadbae84e46bb61508a263e40d64b5","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527811743681","_shasum":"360b03722760575b8e709e2eef44b7cd2317b952","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"360b03722760575b8e709e2eef44b7cd2317b952","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527811743681.tgz","fileCount":32,"unpackedSize":269467,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEI6xCRA9TVsSAnZWagAAF60P/1u9kjQ/bQLAhGoFYitw\nLs6wtUyGjQKX5qlZr7XyPtclhas5eP7E5A69wPWwKg2NiMCNTml9RbURmRip\npYNkiVXqiFKUF7ebom4MeSXVNOyAXOIRn5p5z8OZ6E+Q8fXMfSO8bZFvihIM\n68kEILUEVwD/LsqN4Gkg7e4LL8sVpOIzfY5mqywg0x0M+Ugn05csm2AJhnSo\n3kZYgj7QruT0ojLEY1/aAWbNyEQ31d6XwluIjxHPk26iqDiF6sS78jUThiBw\nPT/Iv+J8LRyoVcQYyFNtzITC/MvadXHpA/ofxl0cjS+pNfy2UMHfLaLly0rG\nUFDSmDCmIXexAGQRyTKnJcEnvxq23Bs100xRJOiL33MLg0gdg0DE5Ud/4nVg\nc5UpuycTNv+epiWvhD9ngpgHb9tqK3ZDhAc5i0qVUuqAT6p8SfHAabRDHRME\ngnpbBuwYF8sSYc0DNVu3Sfal1m+dbqJWa3H0Od5jx9lv9pLx/D7NLwa+gS1p\nH0josI7spLvYNFnU1hdxVc+aPpwuK82QV76BIYU0XIcrMjto2x1Bkjeu+yfi\n3Z65K2pxv3IYYLTnrLHCT9Gagf0TTnqxUzeHldbQK01bZ6IYYclNL0Uspho6\nDNoOV0FKAOCSHES7O8uBCck/OFUnLDF+drst0NEf0snn4WfSx9y9MMQEUdXJ\nK3y4\r\n=JC+A\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527811743681_1527811761128_0.7303387306706979"},"_hasShrinkwrap":false},"1.4.0-next.1527813649005":{"name":"puppeteer","version":"1.4.0-next.1527813649005","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"724fa512cf8b234ff594e41f273799a1900a9f95","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527813649005","_shasum":"e8eaf898ba56caca4bb088e40d1640525e434d8e","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"e8eaf898ba56caca4bb088e40d1640525e434d8e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527813649005.tgz","fileCount":32,"unpackedSize":269970,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEJYdCRA9TVsSAnZWagAAagUP/0MbmaIICetJF2r60RdB\nCillwxqrfm5Ao1+qYmIl/k6tX3ahqJ3la5zxD2usSX31nfHXAx+BHtf/WFWC\nNaRzsP0v9ziaG7WdMTo3OKhaJG/rjNl3ROcXR0d9kq1EWAkZvT75yxszlyIA\n8Fjd8QT1dC1DFgHIgw30HicEiHJbnRnJDmhKQ33nNE28bziP5c0go3f37uWn\nZbxvl4obaTYok8uNJa9GP9gnYEFnZJII2lli9bgGVGhP4foJm+e/7h/jI7Jr\n+IbFzR/PBoBvB4RX5KYla09sp0OFjGz+CSwINC7NIhfkillLKFctqviTCE/N\nTz+8r+EeGqgWjmXXKz8fxCqglwcsEteM7PgGO63ipPxGNeAFUl9ITW7tuNGO\nXm0XWQTTNasaBkwDnBkD3NMVq1Dirh+wUEMXMRKugJfuGh+RPD3pUWGM511N\nrlirrVV3nc18ox48iK4Ux5dQdOxkqGpDSuP9JQdicFtq0mB1P+Gh7sFYkX6k\nEFEVnFqptmxLsWx2sWs+4UXFO+qtXWkMa/SESJIAjk+Q8u1WcFFYi/WnLv59\n+4h3Dmz+pbo1M9AJdHdcs93cqAXV0ncNlg7MxFzRK0wtJF6f7a9iwJjjlKwD\nuUORmlRh+fj7W+Vna4KF9LyeoZ3mHEloPR+Y2cOH4FMlZfO62rqtBLuxUkjA\no6OY\r\n=NctR\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527813649005_1527813661318_0.06580047388692156"},"_hasShrinkwrap":false},"1.4.0-next.1527816016516":{"name":"puppeteer","version":"1.4.0-next.1527816016516","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"0f8c7e76c22579680e0d3c7d65554a0611bad09d","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527816016516","_shasum":"e6a752be7768e27e2f0ef0bc725b6d062e4367bf","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"e6a752be7768e27e2f0ef0bc725b6d062e4367bf","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527816016516.tgz","fileCount":32,"unpackedSize":269994,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEJ9dCRA9TVsSAnZWagAA6Z4P/izjTmIsvxWp5ePdV07p\n/wY65NK+Nnm1hW+xI/ItwVKuxZAVaQ3O3wKN4xQ128P8i7LSTQ7G8Scw1VU0\n9Y/yHmMXlLgMhjJVLsm1Dv8bsW17H1dO3KhXU5j6QdurqA5pd0yXjwsHTNBM\nG5ZfUAcKgkPuQHBaMAEUXlFdK054oPPKGf2+Va4lsosht4GbsreCsafAcCOo\neWc/wiIc0ipfczq6AaO/umFzOEeecxBPq0UTN/98bz3aUTiJlxUWjuZjMhTQ\nZg2m/QnkFLGLZwUNvwsPZeG5nZSg1a4/IoGiD3Vojh81OG7tMZb8v2QPhq6z\ngH1KuCDny9Upy5ytQ/2WBbLvttpEsZlVb+XLcbMuZCG5XxW9QHWPiyROB/Vz\neteHyzt+/VUvigB+gkQytRiq6wOdD8L5v1lBeSSU9NoA5/E0Z7MEt1ztNO1C\n9j640GDn9/8eLRqoxCMK6NVXlcVnWahkfvni2vrptNxbAR0JFYN7E7u10zW8\nUQYLoHxEgWXC6HOYUGg5ddBdcB1hlvuKSM/id+EBVsp0UqSBTZfqCOrgtaFX\nY1SeGS+2xKQzX060iFF2kIAOe7P3PnFq41OPTt2rmuW9kW6FRLt1sIS+3Ei3\nl1kKc8MOezPpiHeTFAHviIbsF5cgoWVftCjgTkFahQCZcRpgR0IRrElXgGe2\nzn1W\r\n=gICI\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527816016516_1527816029526_0.48230354648946605"},"_hasShrinkwrap":false},"1.4.0-next.1527877736615":{"name":"puppeteer","version":"1.4.0-next.1527877736615","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"e03802688d343d4442ecc92c50ffd57041d4a6e0","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527877736615","_shasum":"6834dec536fcb1f0fcabb6b558f936d4250d6d35","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"6834dec536fcb1f0fcabb6b558f936d4250d6d35","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527877736615.tgz","fileCount":32,"unpackedSize":269994,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEZB1CRA9TVsSAnZWagAAT50P/1wffAwTppGGrEqA3NKq\n0IxSeEDE7VqBydj8ZzgTGzlU4Yu2W47MnkP+qoEpepWgiRrTvL2CPG6vJFGz\nNiKxmGfdzzFQFJ8DhPq3TqVEiYkzCLp27PMEwcmu0f/xEOzBP7Pca54RQegP\nW/zKaDzDSXNUONgFk6VDlpYi0cSu5cesMSZBRzaAVERtBl5ZqiwpofFErJdI\nkiKKwTaZWowruCCr4O8OdCfwozzK/XlXvYJkPM6Wr7s59gbcuX8+96dupt2+\nOQhWwyX8oixyhHpw5iNTL7Q+SJCFN9u9HOBk0nLPJFGwxHgqI+s5xq+YwkSY\nLSlqd5pcWZ4eFIitgpX81/j5YmebRm6NMhO0sI8ksPCfLte1x/DpbdB/Rna5\nl96Z96WfpuBR+zeLqi4XAx6JQ7nrhlLDGZ8PBdjO2tgmHNeyjOwPBdLzNSqD\nmPzG0/ZCFXpUEgVOFZskpAnyicXTnckVyxEYgwzZtWjUst9yomWafqHBU8Yl\nlbvINz0S7WRIXV1adRzKfwyUGG4DipxzE98QBp6Hse0NFFAt7PGBKCCBslx1\nthsMN7keG9j2e+Lj1ApYVPHWZAuOXZ92dLDhoZMNZ/+MASlvH/IaPWzHH6LP\nzd5eJKRPJBNYSCSGmiRRjZvOB0D5JBIilBnp6Y8TAo5/mlokhpvXkLaHHPcY\nsjFw\r\n=3v2f\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527877736615_1527877749696_0.9949155397417015"},"_hasShrinkwrap":false},"1.4.0-next.1527886329222":{"name":"puppeteer","version":"1.4.0-next.1527886329222","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"07b91f61a9cc2352e8175bd22abdbd253659fb46","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527886329222","_shasum":"d1ecce23df8e935bb96023bfdbe28d73fa8ee49c","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"d1ecce23df8e935bb96023bfdbe28d73fa8ee49c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527886329222.tgz","fileCount":32,"unpackedSize":269994,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEbILCRA9TVsSAnZWagAAVRsP/2Y7xtStIhBGUVlXUCAR\n5bHkdhHC2dnB4UjRkXsokVtC/XkHrNByK01EugNK1swhmwXc0gIko/zwDRVd\nContd/P7GDkBzv0JkzQThB0Pq9tadtW6IxKLb15+WLt4pewFtBFJN5dYaFn7\nV2wEl4yiuBgtLIwyLIOZuwvO0l52gZIZ4OTmsXfoYlWJ9o0BdKplWhlvrRbX\nOuSY4nZK0spE6Pm/Q3uv3Ql0ksN+0qDoOF41Uwz+r9i4wVlcArvkhzJbit5P\nbWfpipFvGZb39L1puPB9uIRw5ZD4l4XwOOgiC/c4Q77PM3bxcqR/jFJnQVMC\nrRqnyrfQQCxQC74nPV2B5veSJU8Ebt98xxO5mUtr0timdl5He9fyiaUoEwiF\nwunjRYIluGA7dtONaDo1selDPLsGW5g9Gj0QY8RqqwA/rzWWT7/XfgY7qRWy\n3hNNtoKY1RIDDNuCwYM2W4k1qU+lKE7WgzgkPgimlnCsekGYuQjEt8sVUCwW\n8L7OzdQPuhPOo6bY2cuQRRSez+vY3A1apqd2MOtTDVP6QdzTB9lkZ3+07p30\nOC50V42wfFdPZwasKlBvMfDGieJSYBdDe0bqXHF0p3fbEDBN7CqpKw2lXJg6\nxKfQBoIRTj8R9c/QnhubWa8+JYvJSm3z1LYeza2Q40NiV1N3Y40B/rWeweXO\nooyH\r\n=GPKZ\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527886329222_1527886347068_0.5665482361771594"},"_hasShrinkwrap":false},"1.4.0-next.1527886799309":{"name":"puppeteer","version":"1.4.0-next.1527886799309","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"9955a1e67391ab2be20bbf98eccaf9333726d936","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527886799309","_shasum":"da78fcfc6d2a815032603dde42a734e551939513","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"da78fcfc6d2a815032603dde42a734e551939513","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527886799309.tgz","fileCount":32,"unpackedSize":270682,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEbPcCRA9TVsSAnZWagAAjeIP/jTDoxoPXxvETL5F0XZF\netmSSWlAO+vNeSLpW0D0mJ1a6MtqKUx6XDGm/DTXcK2gliarFNbqRyPQhdsB\n9ZN7O3waHLjhWpQMtO2nmRoLCA8MQPwyTgdO06JyqSxDfeBHjccEaLLenUIA\nb2vf5Ozh5z9wpIW87rY4OKjohGhyPCrsvHjxBwPm9cUyTsl8CLHrOStR/zhV\nYtsSxPUFqES//CFxOnHjhKQNXll6fB7a7MRXYWnPpYCf0wWqctp2Hu1IzXD6\n7CgRZZjQiXvvRAx9eJynhyxWzLsD2fu75axfqGyJu3WFtWRLutDi2yGUPnZ+\nxIWanFYe3fBnzs4xscSsMBjom+W//T/zR3KbmXFO50MTFftN2mvfqUnMdTEb\nxINN1UfGRpMfjetXfOWGyzIJ+tU+NEwjY1A8c101kziBenJ3nTxVLzOn7zFS\nQI4TTsbPpM0mT9RnJix9GOyjEy0R68wRsXMR/zEXt55A+wCQLxruRyrefB/I\nSL7ooU8JMejuSIsNXQrxqpDCJl6L3mUuHiJT3VXMpdQ1vNbZgYOTvJjN8ozS\nJz+7qILRwAV2GAttlVCAjWmkGBJ4MiY5+0Ner0fty9SQzS5EpYqV+WViIeyH\n7uTSHAWRKMtBBgU9EEWz+a34od0sEfbtPNdaiSgg61mDxyk6+LMmvpr4wMy6\nabfD\r\n=NSbw\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527886799309_1527886812506_0.2167847384957522"},"_hasShrinkwrap":false},"1.4.0-next.1527887011493":{"name":"puppeteer","version":"1.4.0-next.1527887011493","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"9904da262e0f7338df17298d5259fe77ebd5793f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527887011493","_shasum":"e6b0618fbd94b2d5b75259b9c7d089a3d3fc2eef","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"e6b0618fbd94b2d5b75259b9c7d089a3d3fc2eef","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527887011493.tgz","fileCount":32,"unpackedSize":270682,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEbSzCRA9TVsSAnZWagAAUxUP/ArbJwDRz2na9HhmLuWX\nFSq9i83aQwTTKKD4ExowPHT7ZMMdjq2UB7Peg26jvgNoKGOPcfdq+W7xukiD\n1bVsiAO+rXLetPGSbCUVNe5Fd7DE0t8QCCMcvAxdVjknmepBfClBPHdvw0yh\nES2VrbpLdVTN3me09biGP8sr8A/b3Jqz+zL1rg+9F/h9et2FkPXZRegNLkUD\njgkLCVnBBk+OpZ1tWcgp2XSjTC49wyMuh8DBLaShZkbZIrnzbZlDdhQaC93O\n7FG81TulmjCocWUHAFiHFvDS/FlR2gihPS1ESXnNZ5XtrznKE2djyakpbVF2\nsQzwKYCvxA2XsJN5gU1XiG0hlCehrZWKmmM9Nki+c6SnpWNET2oSzQfcL/9b\ntR80stMbXaIMMKcV9xaMYk85G67QZcu7FimN3QF6PR/r6zCPfBlWd9SI46kK\nX8/61kWxx8cAC9UqlBj58dO9AU1PiftqCyzsyoLq/Z/Gkm4RcxNqyCaR7Lqf\nIoNXx3QmXa7nuMF76/39IsV/oUs9AP8mEgKIeoaHACHSTvy8UfsmG+Tk60fO\n7JKOFDV1CZ/+uv01rr0yrDm0mS/WjXi+GTYOww/UBVL3CTNVVt0V0HPMAW+T\nSGvbxFT8PtsywLG6Fa74jpcu9Gcz8FXPA5AFV+zHwtMHyY3ir5u0wWoK3XEK\nw06c\r\n=01ns\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527887011493_1527887027301_0.2550595082350986"},"_hasShrinkwrap":false},"1.4.0-next.1527891453248":{"name":"puppeteer","version":"1.4.0-next.1527891453248","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"85d5a3348cc6875fd390d45d4d2424d0b7228e51","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527891453248","_shasum":"59d3b4dbca6f449bfafc6d47f6aaa13a8d19e71e","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"59d3b4dbca6f449bfafc6d47f6aaa13a8d19e71e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527891453248.tgz","fileCount":32,"unpackedSize":270682,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEcYKCRA9TVsSAnZWagAAFWEP/AiBBssQAl2ruRZj4OKx\nCb4NEKfQkn3gcKNBCPBsD0UtfowEgzs/wa+OK0qxMvFk7EVK/GtdY543b0Fr\nFFY8/OEF2MpjcbVtxbX9llBKDdbZVrW8ATGQTcDZgVoBrrAPkdyZpdLSQdVE\nJcPQO8zIonmRchw/qmK6v7jKkn+k5fWF18UCbuEGtEPVGmMs40D1zeKpdqLp\nhimrD22zE89qw+rTgFg/C7XP+KKofUOiA3zc//LgM7n5Np2CNG9uvYVKOD+J\nuX0QywEIXHkUhYQ1ZnUSzVXTwomnG7dx7qZZ0jprhxyzwHO6xfkbGz+654Gl\niyy9ylmJETusPeLU/eSAJpvMEAZPxtyf/W06y3L+rRUSmVusFaHWuQykS5V+\nZELhFFtJymwvup3AoX78ToYbwPowG5bx4Sylo6wyOmDKPwl7EHPICaFVBUWB\nxp7e9amlOrYDHuyqQMXyRzGY9J1EskxKxNOfDHXemTOPmMa6OSvv0nS5pOGY\n8ZCiH5bsD0fDU7rvCj1NaaEf6OKzdkwr4cn29VWbkEA07zoIW3DXvIqHsIH8\noAOvaFa8EdWU227DfqDTVyYIjF/6bWqF/mh4WVvrnNxDrEF7kDZafWHFgDk0\nKpmau7x2Azfmohf+kZ4yLagYgxxdmuO5gMQnujlm62lpHmxSOnXIZ2b9dqIt\nFuva\r\n=Odqk\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527891453248_1527891465945_0.2697647568405157"},"_hasShrinkwrap":false},"1.4.0-next.1527891760955":{"name":"puppeteer","version":"1.4.0-next.1527891760955","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"puppeteer":{"chromium_revision":"557152"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"d8023726c5404f65270d9753681476c72bdd82bc","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527891760955","_shasum":"8b7e4d3d15c5f0360d8d2c4f80b9a08f78da4321","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"8b7e4d3d15c5f0360d8d2c4f80b9a08f78da4321","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527891760955.tgz","fileCount":32,"unpackedSize":270808,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEcc8CRA9TVsSAnZWagAA/HsQAITF0cDyxr0A9IBZ98tb\nLuO6RjQx/KggyzxcX7tOarNYmDDoXqMNQ6Nt4vzu1vzXgocOYPZw8XXTt/g5\nHemUEr1bJbo14AUwv+c3WnlPQilPO/Spe9hr8PfLlcZHuAhNC3mLjurhE9MV\nUFkmiH08Okkq+24pWY+8uvWk/VglTbnPs+184GV+fcAKxYk+VgbzWMnh91TT\nyS/pSZ64dmPFSrSyZnErMr5kk+Tf3dUwJ/897P2lJ5m6UI9+B9e5nlDxYcZb\nK1RSszsFOHGNQZZnsyJQMRXm8AAG+MV2CT8+H8GauytdJDC3bg6cxZch0EHB\ncvLk5U9jDT8xmccFhSnJ0N/OqltYIgBFCKwrSlhr3ugjyNvXKteRfzzrVcBN\njQRZa2SwPIRTvnyK2srUx5XJem/tWINOsHjUjQrZgZHwrvIplfn0uvCYXoYZ\nq3p+Povn1D62GL5zpjEkTZEPf0s2f/nwQNFfNhFR+zPI9Xikp3NcG0h8zOLH\n5kKC8DiMrjWm63KHAkLY2LKZWJiYXTskRYo6ZQ7FuLwhUeUF4FLFkqj2pbvq\n5Qkf/4yIhdM++Jzkb5r1d9E7IIhdp8caW/T0s1Aa269CeNRyZ/xyAQZjAbn5\n1ypKsUmDrVl2Ya0euu3+tybyNoKvf1WVXhaVNeDJB0Vt5UhXG387Snmk1QKz\n2/We\r\n=tsWH\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527891760955_1527891772363_0.3958728870377468"},"_hasShrinkwrap":false},"1.4.0-next.1527958760421":{"name":"puppeteer","version":"1.4.0-next.1527958760421","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"563942"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"efc0e0f96ed030f7c3993e4c23ca9e0db60d35db","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527958760421","_shasum":"70319ae17099619288da34ff950e85fd2484864d","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"70319ae17099619288da34ff950e85fd2484864d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527958760421.tgz","fileCount":32,"unpackedSize":270808,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEsz2CRA9TVsSAnZWagAAmU8QAJP/NWmTwcmPv/0XFxKq\nRB2wHGEPM/4iTFe/kUbjKEodGNdOtFuuphd5bCBU2aejYK8gkPQdAUAW5vC5\nF5DSBU3BTrJNQLlm0OxcAfWHM7qK+CYQd4z3rg0LIzFirzHLScC5QPijdHrh\nPiVJh0quv1+B1aQryICD0LIiPQy0S8mFhQnEkmZNG+2y6JnyNKDwAMIfrhY1\npMROxOUTf3Y5V2SLgT4qovY3sPXjEjG34ksv+9KHp6hs2zbmPuAS92wHaL+u\nSgT8GuVQsYuDX4tHY87n9UI4qs0UzNDTJ8jBjklY4Bd6dm4aBkothbPG32JV\nnGZnQCr0crQ+13sw3NyNLpI+g+PbzfX5L/OZpybFgGaZ7JFHXv0sTAuy0Vom\npDHnVOvSozV7pYMlVyA1rNaT+yADQ5VDkrtfz+HoKrS8EIGYNqt1qjes0GOk\nRAfvWEwGCQxF0U3qdte3aJtZEv9y+OjzOvbhC32T/QRj2KcbsEuIub2H9Bq0\ntmT55YW9lDob14k3w60eyUpjjLVSREhEGXLHCdDdPkpnNW2a5r0IAhy08GUI\neLrYs6arO4ZnC9zixGLqhPtPw8stnKtgWvCRP4XKSipP4/IGNpshrjOoBq4k\nJo6cfKp+80QFfUME+K9uyrr5g2GL+gUWL9GTKVq8zVDJmAlM0QpIid7Ez0m/\nPV51\r\n=EoMe\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527958760421_1527958773941_0.6244253945699143"},"_hasShrinkwrap":false},"1.4.0-next.1527965268824":{"name":"puppeteer","version":"1.4.0-next.1527965268824","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"563942"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"4bc23319a2663337053d38a00fd0ab6235ee0406","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1527965268824","_shasum":"042b2b8c23422f420900d5768d45ee4906496562","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"042b2b8c23422f420900d5768d45ee4906496562","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1527965268824.tgz","fileCount":32,"unpackedSize":270808,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEuZnCRA9TVsSAnZWagAA9SsP/jAlCSdyBi89cIuSvuiR\nid04UkF+tndc4FQaHVZkJKp1D5BDTKpbHXfq/QyC0qjVi9zNM6B5/YUEV5Om\nh53nOkUaAY2fOM8CgyunobOb1EEy8LMIWDD72BviXGk/TyYhhInITUoDAti8\nTZJpkEa/SzIbCKu3u1VtIurkd1dTwrL/wr44WzqoOOA7x3ZjSPPCFIfmiomI\n+pW4Zqxj/vnLkzvQIf/FKyQRWWAVWwFqWwXyfFjy6rhvUksOf+zHmCoWF3oe\nG7Mg15W9TM9apBupplRGzr37kbHA1CPfNZc5mrW+EkJ0kHEe92K7al+AWjtd\n4D490sKpNq8eeN1GxOppWhiUX3UYzOcxdCHyaGI8ehrGyZXcp3oemaBQ4pVT\n1MQaqc3V8xa/NBCEUpNoz0X6bvn2XiLZI4+BXosk2mSJ/Yd2/8pbnMrmBdox\nRKc6LHBOVgYC1PE9OqRtcLKxn6d0vNAjp5Rw3v8Sqh1WsqR7ZBc/sEDSHwvu\nifYYVVx3nNzx7hILOuLtwZFaSSFtxPRsYC2R+EQX3YXNCLzHC35tes4t+6wZ\nDPcot0HaIaXQCmE31JQoeYhaVWU5tdBH0edFiyi3lRO1eyTFlRoyErB36ZhE\nixOku9HKPzGhB2U4qa8D5Cad1GzQ5AHiUK5pZseeTrdwsr5x6VX2hNXTyvhn\nRRLR\r\n=1ocH\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1527965268824_1527965287657_0.6259755352380754"},"_hasShrinkwrap":false},"1.4.0-next.1528296840819":{"name":"puppeteer","version":"1.4.0-next.1528296840819","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"a0584689480c4e2102279969b515a837021f6f24","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1528296840819","_shasum":"6216d117f093f4359f2e06a0db736ec2c7158436","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"6216d117f093f4359f2e06a0db736ec2c7158436","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1528296840819.tgz","fileCount":32,"unpackedSize":270525,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbF/WWCRA9TVsSAnZWagAA1wsP/1fuE6UbzAcgqxAOjm82\nZNKLSIpTbHn8HhPBbBhisR/cArWqXdwfHiNP3sj9RsWZNV38hGCzOStrqDHF\n88A0P0wPPwrtXW7f6wsUKEjFzkJmYA2Nl7zBttX1Fol54RatpS570emy8gVJ\n97+wVZAUZNZOnR+3Wq87EGsBvBo394IUdr+XntW8T6a9dhVUq/b2a3JvAgqN\nYIymXrOTsCH79ozyIG4WA68oHpZWYFPZajUGB5wlJO+47b3RTm73rWCrWnsU\nnt5qz89fNnlIYeiQASBoyMuFln2vpUvoTMS2QwJJZvbpK4ixKSPWBEVW8GGB\ncFsfj+VSx2N8SGiPD/G6oV8FSEz5o7mBK1uDdGTwji3D8abOw8V25KLIdRUw\nA9YKb2L9b+/6BUBuSDKTHejpARM4otUKbRY2aPHg3ata2Kb6a1XSISu4Gm80\nZQ4ieMqpnPitZwkWa0sZVPRL1h6s3neEVllUlnsMpRCoiQcwxuTRWAgaEzUZ\n6hSyzFnqs+4jy7VVFDOmDsK2dn/s8056r0s+YanjHyqcErQZFMOloheoLTAV\n1nijKX+TISiyS8Ym/VXE+21wu4AArhFRLh+0dqUY6fJ10urWPpJHRAYv/gWC\nz95F0fCmfqSClScG5+wuCdeWaqmiugK13Xb0JkDnveVTH5vu3sdDuQva+5wV\nGsBD\r\n=xTjA\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1528296840819_1528296853305_0.14517681148067685"},"_hasShrinkwrap":false},"1.4.0-next.1528334015125":{"name":"puppeteer","version":"1.4.0-next.1528334015125","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"36b87000e4c0e3ab1f4e7c81c704d9ef331b9187","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzAyOTU1MzQyOTQ1LTUzOTAxNjE5YWI0YzNmYmRkN2I4MDg2MzI4OGE3YWNhZDBlYWMyNTlmOTJlN2RhYzlmODI4ZDQxZGEyMGIwNDY)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1528334015125","_shasum":"1f2eb64f804b40d46d37d0ca12f4ea642560ac4f","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"1f2eb64f804b40d46d37d0ca12f4ea642560ac4f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1528334015125.tgz","fileCount":32,"unpackedSize":270525,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbGIbMCRA9TVsSAnZWagAA6JgP/1dVStaCd7hVapHffc46\nNkDbMaVnZhDycSs8b3VO1qHh5w9AwC5O6tZbsL7uXCcduD2U60KiM6Taw7kt\ny0dy6QPy2pPRCX21/6+DB5BAx+y1gMq8F0QPGd5fwdFN2TinGGRgnRskS6mi\nttoMU20DoOGsSczDGWaNNUQgtegpzOPNlsnT225HVDwEJgHtCoZWPgYc1+JY\nK/LeKoNnF6E1UDkA0nDHqRL6pAxkTCx+KrTP+6VLgEuW1b1AhxQECZem22j2\nI7efgh/Hcs4WBJ6RPgjVYRIxGlwdPNlyRxvZTDNO8vbsYqzea2Rb5QAvsTTE\nB1t/a22F0uUpl0cJ73fvUh6pUWhBioKHduDCcflF8EeB/C3VMlTVrHGPBdyN\ndm7Mi5KQGwQY/0co3DzYMDO8tcdmBreE6jw/pnX613Ccj8j+awxG39cxAJ8U\n1f0V6OWwcICdkd3K/Crmv8NbQ9EKJoaIoFmoTOf+xvHIPW5gbd4aR2TBjnwf\nWDo/rW1PfMG/yaL4SN8mHq3NMbHMHkZk5B+0FsM6l1DLObFoTr68G46nKtLv\nlLm1JqBRMDd1EdVygKN/DAaFUPbeHCpu3G/2CJ4t+cMtmgPlLoiEW8+hORlz\nkq9uxA8LQ6MSaZ4akYh7UoPDrhO6mnCqzwc0eU+dJvqieaTyHbsfiUzl9/AL\n9sq5\r\n=xryk\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1528334015125_1528334028323_0.23718010184480498"},"_hasShrinkwrap":false},"1.4.0-next.1528334094813":{"name":"puppeteer","version":"1.4.0-next.1528334094813","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"3e82a54fd15847069fe421e786bce07e2901139f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1528334094813","_shasum":"a14ad0b8e836c0b8cd45838a961dc3a6695f0c56","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"a14ad0b8e836c0b8cd45838a961dc3a6695f0c56","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1528334094813.tgz","fileCount":32,"unpackedSize":270525,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbGIccCRA9TVsSAnZWagAAfOQP/3RR1HxJiUd+7eeTidb/\nHHSlEojtEOVwhV+RYgx370uUpzBvwBkebt8szHv8S35zlCgGRcDhRlXQwXsK\n1XGF9klHCCfhD/ol8XeLevwoej2dmAOXyqeR89gqZyjuaYBLqMi5TtU27vwM\n92ezo1yPb59f2gGQvs37r/ppbdggVdHx8sUqVHrXKLUWnXlYaOIt4cQ//Rar\n7l9vvxZRpwqZJPE4c6NWYYnEPpuUvkmScWkXvCziMJcFoebKoXPM+uZIWfYs\n7V9pRk9BEX/r+w4NLEnI7AdC5pt6LdMrENxpbigC9iZZArI1OSFgwa1q7xyw\n/VM5u6uKZyXrg5namSxmBhwYVi1R6UBY9zJE9TkHnKO3nLRb50wq2osZDEjB\nzQ4GvrYeuR4MVLDMXYFTdsABX+O6u03OlJuePUExTfRaupL9f+fc7uY9wJqt\nQeC91L7Rmx7ioWVycSlg7YRMsjMHwNJuPose7gjqcdOFFRzN9Er+Yqwt4+JB\nW0BH1WMdFk8omAWR2nMJcEl9gr8q0B/YVvKiZl7S5G+pbi09t3BhrpX590/i\nQ4K1VY0gEbDXYgJ58UL1cxerruDLNjQ8g/J+aklLrzL8LRZBLxuWmOEoYqRw\nuj38DGa7cg+IIfw8y7jaP8SM76pJMS83QPqRLaf6/YYglYQYHDFBd7cixkDm\nv+Az\r\n=dyAB\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1528334094813_1528334108070_0.9777603448537668"},"_hasShrinkwrap":false},"1.4.0-next.1528334327491":{"name":"puppeteer","version":"1.4.0-next.1528334327491","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"2ff0adcad8207f85865ba35533605361a66515e6","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1528334327491","_shasum":"4ae68e2e834f97b51e4b01359e30efe2b68c3ab0","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"4ae68e2e834f97b51e4b01359e30efe2b68c3ab0","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1528334327491.tgz","fileCount":32,"unpackedSize":271097,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbGIgGCRA9TVsSAnZWagAAi/cQAJEJDbtCtmw8Zz/XQYbK\nwoGIwLxiLsnC4Wq0+1JntasovYO7TsoWpXRm1Y/XHAG0w3VRBfnvX+loHBTR\nGPfL1HwYvdnPOU2o5d6jyFP34MS9Ygenos9nkYjhllVqKcAalCFi7y+orJM/\nx/ca6303EQyWhDUg1ACb9eWf5i/cR9t/PZZTCtho43K6pmtOpPcpUzioyB7N\n+HRfEIXmnzmOptSxhtPyQxGUOfWsOoDnbMHiI7c5NhmCnZ3EimYDcLQtQ1wi\nSDsAhKeiGKX5Zk48udF/B8w5CuJqV2pcWs5jVlJhf4hCdOj2IbqEF9JwLyn/\n7H2biOw6yXqhah1oPDGYq6hpUvWl8IqOcepSSPVHqQ7BXTHTX3rCukZXZLB7\n9c56bIXxXUHSa4jtukFOevevVL49HwDKfOj1ec1LQIDLicd/rg348R9/4mvd\nxOPcl4Ox2IHcANgLHIKhZQ6BfQD60WcackMWsUWinK+LxSsKQ3jiqUNP83OI\n1jU+2HEPVXr3RrHIDRQRegbReg2NwnEfCTd4ogw72lcjDbb66rcDvL2VYJws\nWmGYseIY23pzUL0TEM7kxKncFm1G1Zi4GoDw5p0PoECv+c5OiJzcIpVUp8uU\ncP9eUNPYeGy84sf2YFXstrA0fcRyiyuhPWF3mYACdu0S/cpmQl57+6XvNvHZ\nfCdy\r\n=m2gp\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1528334327491_1528334342021_0.12393109909219535"},"_hasShrinkwrap":false},"1.4.0-next.1528389663924":{"name":"puppeteer","version":"1.4.0-next.1528389663924","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"90833352ba97637e6fb7e4bcdd788293a3a8db04","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1528389663924","_shasum":"27ed0b51389a567eecb3ee2ef36445d496280ee8","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"27ed0b51389a567eecb3ee2ef36445d496280ee8","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1528389663924.tgz","fileCount":32,"unpackedSize":272746,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbGWAtCRA9TVsSAnZWagAAkP8QAIIBWNm2/mbuV5D497nz\nYIwkr8kHD2bWoIgNZIiYmYFLe2re+ieDdkDvLDVq1HrC1pJIqfaY/4JTrwO6\ngiA4qL3R49ggq3sEw+w6nKzT5zy2MzWfHRmV/BwZm7fpAPDvwctAWGcX+BIx\n0aUOQPAeMEPIHHKNkCDYfrgh4ssyDSdGMf+/6ZjqTeTMD2Uktk0dNfIPtpYV\n5ruIXk5tIgi1lK8+s60LgTMh1SlWRY/zu0WrlojYaRVWa0Vot/VAwLPkLYqI\naPqpk/enCl1y7viPuR4UgVQLvPEE35sM0akEgQP8Ng7A9vEufQymuWQ1TYGR\nigUkw2E0iAZaHx6SFZCXLAcOeXSw94O3Za3GWmtPy+ERRL4SfqYVLJI5PvpW\nyJyAeMDip9itUocy2IJ8NgMbtDo4miKYiTz83IaNz840DlpsEnP6yqvwgk5L\nTuZb/+20D4fD2w0kInfYrkL6TSTDh4Q4YLlSlkj/xoYLvwwwpeZ42OV9YnK3\nBUjnOHabl0j/Jh3cm34vQR/TGocvB9Pr+TxbCDLpd2TJqu+JbbsX1dQ3VAHh\nPQb39cLRJVLMVH1X8gizRFlXhEOknrXuHedv2vlxMK5N56w2QgIlkv4W20O4\nDhq0j7ed6I1GO4ewrs4m4M84GVTf4zEDcWk0c6VmaCuFdX+VXqZU3ZcV2AUx\nOlkv\r\n=Z7Yf\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1528389663924_1528389676765_0.34298583964879703"},"_hasShrinkwrap":false},"1.4.0-next.1528395894335":{"name":"puppeteer","version":"1.4.0-next.1528395894335","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"75ba86f41ac4196dcfee515900265edc44ffa2cd","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.4.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.4.0-next.1528395894335","_shasum":"6bd61d70cd9ad4fede76f45da0231b126e4598f1","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"6bd61d70cd9ad4fede76f45da0231b126e4598f1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.4.0-next.1528395894335.tgz","fileCount":32,"unpackedSize":273034,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbGXiDCRA9TVsSAnZWagAAhL8QAIp/iHVVdz3C5bow6CeW\nsdWgX8AMJeG3ZSztH830zUu0SIq/fgkdsOt6gF0rmKu12pmYdATAcOXsjqz3\n3Ux2NtoXgM+o1FMXgtkyn2HWp/TGokOAYjshK58oGddJBnhbjMkfmkL0mwNZ\nKpU5AZMD54JcBlCe6SVpl+o5AybIrNLaU2MuwnDejfG/Vqu6zhvUSkQYV5Em\n5s6YnnTGCTXc4PH2hdHjf7IBdj3urdhcXLc0Cd4IPj9nmzsaiZusfTslGAy+\nCXurrFiehkVJDeyriIzMQGjLsX3evyJi0g3iKBZH2pB3mtZlpXcZMWQAiyY2\nLjDIbJCUjLexcGY3RZXGlp10PDlRPpvIGzmsP0u2uHjkJ3zxEnXb3Y8rI88k\n7yS+Sb89B0HynoqPb/LRlC8+KU/XvgnmgcAC9DTEcQCNlAGkrK3vMhpvcu97\nzIoWvWr+unnR7e2MFsoG875xjf0RBodlawCaI3YqOi6dN8y3hAjU+jV5XtcZ\nVX6tmTQimOsiPl+hJp2Z+mTuQPa/czainJwlrLdBxhganfnHJ+GQM5gAQB1r\nWW1ykhG75kM/wgI+pQJ3FI4pkWuL2Zx6AUkCkUktOTyb1PwbGOWEEWWXBHEO\n62KCuThKY8JsYlwHWLewuQ9VSRNYJtrLYm7G15KW/sq8S95zl1Imq8xu8koT\nIUDB\r\n=csq/\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.4.0-next.1528395894335_1528395907467_0.6663344947456478"},"_hasShrinkwrap":false},"1.5.0-next.1528399382159":{"name":"puppeteer","version":"1.5.0-next.1528399382159","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"194d58002678735660187586e86c38e97ad68278","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1528399382159","_shasum":"3778d5edd38f34146b06d75f378679ccff57228f","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"3778d5edd38f34146b06d75f378679ccff57228f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1528399382159.tgz","fileCount":32,"unpackedSize":273034,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbGYYuCRA9TVsSAnZWagAAqwsP/37W3Mod09lUO0IcNBkh\nNtRpP9AUHJ/Ruzd3P0RCvi9qh3H38gHe8oMuVsz95hhdrcEqmfsVKGpdbEbF\n+hIppq349VhSxdd1T6fmLzS4QsavrDUSoqDek4S1EavYPEdhE0xaPoApWSTp\n6yUWAjehcxuDiCJicEjlyQHXpZMTXMC5eW1lQO/0ry+6tCUJ5ugfd3CRS4U9\nsCmjPfhcvqDAIALNJLaSY5QW7eG6DiZKhJ0zgGAbQ1wlYzynO8EIZvoQZz8t\nB8SpKDTEPhsUlKSSTB5GG/Z3qlxveckD2n6j0B6NPqEuq5WJfgj+DQOJP0nF\nBxOshkb89NVSHNklSvco+eq12ZCXP7Dm4HhN3Cw3SM9LFQEob8OecQ6yi4I8\npwVxmEBfaz/Nlnxp2es+s9S7GmqaAHjnOD3dZwEwLx/vsJyIW4Tz2n99gs54\nWB/Pks5Lqswe/Ju1Z88q4Fntz8v+wy/OSo8PgRM5J8WzgVRuTxhsqPdrY0Hs\nNHTdDmztkDO4I0X6fc+PqbY65dygl0jtyHqBAePb0qXSNEt0KOL0P9NRgch1\n6xwBsCM16K6c8yVXJfwOVCh8RGTyix8uEYmmUXd/NS6GFPpZDfX1GcH3eBKs\nuWTsEdhHjT0Ydaj0rVbyP3/rNG/JO5AKK0DsGhokx0MRChfOKKhVDthJ6IUc\nwJ/n\r\n=PWwx\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1528399382159_1528399406404_0.5021960969207866"},"_hasShrinkwrap":false},"1.5.0":{"name":"puppeteer","version":"1.5.0","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"194d58002678735660187586e86c38e97ad68278","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.5.0","_npmVersion":"6.1.0","_nodeVersion":"10.3.0","_npmUser":{"name":"ebidel","email":"ebidel@gmail.com"},"dist":{"integrity":"sha512-eELwFtFxL+uhmg4jPZOZXzSrPEYy4CaYQNbcchBbfxY+KjMpnv6XGf/aYWaQG49OTpfi2/DMziXtDM8XuJgoUA==","shasum":"e35db3f3ba3d41013feb65be02bdaa727ec7b8ec","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0.tgz","fileCount":54,"unpackedSize":579792,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbGYbmCRA9TVsSAnZWagAA+BEP/ibKIfH/HcMGaR4kEsyc\ne7ZBSYrAT3B+gI2ybBaM0qPjPuOStPBNHHswXJGM2mJ1OZX/kjY0UQb3OfQF\nbSaUn2WmkVIw3y1csWj5ao2izsYpYEPFjbwzDfE3L4pC0MbdivpHTrp7joKr\nE4w/0dbeZrnA+3Ft1JxsloqjRmmHDpcf8xVrACTdt2AkX2VdO7kiQ/m0jVSo\nfX0WJuZwTUSg5UvQ5e/NzMDFWgMVQwNs1pXCj3ZBhkByBM0qb7X8Q2EfquSb\noQafY+yBsDIMKdmLLsYHjVusJIAksyUsSReG7C5ew4hZm4SH/59fhs6ndnAO\njRq++hKG+t4+YtBXTbDj4H3sAJ6yu5frqCfgf0Gxd77CSXtRJLxGRKiOm/Q1\nDPlCM8aMLmV5r3ludZDfg67Do9zLc6COBAu/FaLjNs23e2aeM4+T/yTpo1ZG\nAfpYRnDr3T/P/JSHz3m+ZwHISLF2U49HJDWY0YVZxMd8eqY5XeCuO2l2WclE\nHbGq4UUnEe+L0oltzKhoKet2+OLgBocRSwH+aMuyTfQrF8JyEjV7/WpVoEqP\nbz6dAedy9dhoiZhXhIvZf6GXaALXojIYHpZMq3wsbpgB6cDtYr0+TsWxzAiT\n61VKfmb8jREtx/EtR2VYFSiV2MXPcxPxoYBOqqJtspMvgYP9pTXYGIwEygt5\n51kp\r\n=dM2P\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0_1528399589770_0.21315590008818708"},"_hasShrinkwrap":false},"1.5.0-next.1528402191643":{"name":"puppeteer","version":"1.5.0-next.1528402191643","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"147f98d1f0e02221895573f2b0958125d9a7ddb4","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1528402191643","_shasum":"5248daeee21a4d4cadaff44945e9e5bee7ca8765","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"5248daeee21a4d4cadaff44945e9e5bee7ca8765","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1528402191643.tgz","fileCount":32,"unpackedSize":273034,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbGZEbCRA9TVsSAnZWagAAizsP/0ggb2J1GL9dC/QHidrf\niuhqC3SucMH1Unc5vAjoDP9j7bNLs8EmszlaRGIKoel64b+Em/NA2la3e6eK\nS/2x2iquwmG4dDzAMaFpUauT5IGDEzKRJy41DrVbb/H5mpi7EttL6sEkSFn4\n3WxIrPa/JrM/Cp/LMCFAobFMcbGFnewXICaTVhMHcFbYP0LvyhFAQyJv9ikk\n+/hCwPraH7uTI+Y/XH42pCQAb8Y98sSqCSWCyTMu15IDhQNyTQkE2VsuO1RY\n/AE4xkUbpONWw/lcZPHknDf+++hlaAG78qfd6wWJ0V9zWP8JZBav0TaqaPGI\nydSsYlzvDrHJ0UlPxT2DjRyKEs3ToRrR1Cpbue4FKjiPBKVgkmEVoeDqAb3C\nw06UTiNMGi9sKz2knaDGXe7hu3eoD6RFJ8ax5LV/bLZNxPWzyWs2W5jB5mZ5\nDZhGYC+OBny9sVZEsjMZTh6OQ8Jd9bFzE8mmIb7IJwVvsf2fLYXKE8czJQ5R\nF2OSln+t8o14OBwNTYR9iRcVH30gtWMHxaxfohfdjNx5OkqNU+AvPb1NXe4f\nbHAIw0sM8nulNJrdnrVrHbRNf8igSOJOQMFLwL4cbxrjxlfbnlPtOysSf3oe\nuZhI2uDOMLIkvchXTbUfpLjNAlVMtKhjJUptt6nmD/Bp7jE/ts/M2PBM9A6C\nrbxr\r\n=vhf1\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1528402191643_1528402203362_0.45142725442041143"},"_hasShrinkwrap":false},"1.5.0-next.1528919394878":{"name":"puppeteer","version":"1.5.0-next.1528919394878","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"d481fd51476125f6e99615399b018a138f192b49","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1528919394878","_shasum":"d4840f8f016a7e2555375a7375ee6876137e6f4c","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"d4840f8f016a7e2555375a7375ee6876137e6f4c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1528919394878.tgz","fileCount":32,"unpackedSize":273067},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1528919394878_1528919407299_0.6110304852654682"},"_hasShrinkwrap":false},"1.5.0-next.1528948338383":{"name":"puppeteer","version":"1.5.0-next.1528948338383","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"1875cb48773a7767b9ad16a7dbb4301bd42faf00","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1528948338383","_shasum":"549be7644a845d17739ee877ef4efb948ea1af55","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"549be7644a845d17739ee877ef4efb948ea1af55","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1528948338383.tgz","fileCount":32,"unpackedSize":273067},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1528948338383_1528948355920_0.4208268345857866"},"_hasShrinkwrap":false},"1.5.0-next.1528996935297":{"name":"puppeteer","version":"1.5.0-next.1528996935297","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"93e128931f84ca1b921e1eb9ae4331fc207365d2","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1528996935297","_shasum":"b45997685fbd9e99a95b6968f9f4c121c7f45ad7","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"b45997685fbd9e99a95b6968f9f4c121c7f45ad7","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1528996935297.tgz","fileCount":32,"unpackedSize":273067},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1528996935297_1528996949549_0.7131653394287674"},"_hasShrinkwrap":false},"1.5.0-next.1528997168247":{"name":"puppeteer","version":"1.5.0-next.1528997168247","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"9498b1057b5ac1fd9ebde8274e16b3859a0f03cc","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1528997168247","_shasum":"e2647dbd87731c9e857f6ccd2a59d429b9a294ec","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"e2647dbd87731c9e857f6ccd2a59d429b9a294ec","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1528997168247.tgz","fileCount":32,"unpackedSize":273103},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1528997168247_1528997184730_0.9162714973601245"},"_hasShrinkwrap":false},"1.5.0-next.1528997315916":{"name":"puppeteer","version":"1.5.0-next.1528997315916","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"eca661096be93481dd83bd01525f106af0dafb13","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1528997315916","_shasum":"554aec18475b86321ff175ce4fdbbfaacd946f8b","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"554aec18475b86321ff175ce4fdbbfaacd946f8b","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1528997315916.tgz","fileCount":32,"unpackedSize":273103},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1528997315916_1528997327341_0.4738073146993216"},"_hasShrinkwrap":false},"1.5.0-next.1528997827655":{"name":"puppeteer","version":"1.5.0-next.1528997827655","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"ed7a26cc95628cd2d32de7fd45a4eec2833dd0d7","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1528997827655","_shasum":"47593d16d8b8a1fd3d500f5279a0423caba7ea58","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"47593d16d8b8a1fd3d500f5279a0423caba7ea58","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1528997827655.tgz","fileCount":32,"unpackedSize":273148},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1528997827655_1528997842687_0.28602257428957834"},"_hasShrinkwrap":false},"1.5.0-next.1529001772241":{"name":"puppeteer","version":"1.5.0-next.1529001772241","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"ddfdaf97c5b3375dde5fab4f4ac01f10eaa5583f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1529001772241","_shasum":"9c9976c49b6f2665b714f4702d77fb7c49977d96","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"9c9976c49b6f2665b714f4702d77fb7c49977d96","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1529001772241.tgz","fileCount":32,"unpackedSize":273310},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1529001772241_1529001788174_0.7466842235683606"},"_hasShrinkwrap":false},"1.5.0-next.1529009865250":{"name":"puppeteer","version":"1.5.0-next.1529009865250","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"cd8d75062826ee9dcb511126d000773413a9c681","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1529009865250","_shasum":"098da606064df102e83fd380ddfba62fd02a635b","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"098da606064df102e83fd380ddfba62fd02a635b","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1529009865250.tgz","fileCount":32,"unpackedSize":277225},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1529009865250_1529009879626_0.9836254046388315"},"_hasShrinkwrap":false},"1.5.0-next.1529010081851":{"name":"puppeteer","version":"1.5.0-next.1529010081851","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"38f112f39546fc76a1ac3da7b42c02626fc581b1","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1529010081851","_shasum":"393f6a9ff0818c9c5b7568ee5bde0c98db86aa96","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"393f6a9ff0818c9c5b7568ee5bde0c98db86aa96","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1529010081851.tgz","fileCount":32,"unpackedSize":277357},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1529010081851_1529010092379_0.8575475702544717"},"_hasShrinkwrap":false},"1.5.0-next.1529012067283":{"name":"puppeteer","version":"1.5.0-next.1529012067283","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"9a650c818d79c95af47816a8d8bf1fd63cc8e6c6","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1529012067283","_shasum":"e8c1d3acd9a8f20304da00c3535beefff81ec4b8","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"e8c1d3acd9a8f20304da00c3535beefff81ec4b8","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1529012067283.tgz","fileCount":32,"unpackedSize":277219},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1529012067283_1529012081319_0.14413308220262833"},"_hasShrinkwrap":false},"1.5.0-next.1529015425897":{"name":"puppeteer","version":"1.5.0-next.1529015425897","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"564778"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"73f9c48081017c228ec1f1318c3c7946321e0538","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1529015425897","_shasum":"687cb4bba15f2d784139bcf4f3a634a71d7bb764","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"687cb4bba15f2d784139bcf4f3a634a71d7bb764","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1529015425897.tgz","fileCount":32,"unpackedSize":277888},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1529015425897_1529015438291_0.7680338101320106"},"_hasShrinkwrap":false},"1.5.0-next.1529017025751":{"name":"puppeteer","version":"1.5.0-next.1529017025751","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"567388"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pdfjs-dist":"^1.8.595","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"861f07073880e41373cc74557dc6a8595db34c73","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1529017025751","_shasum":"7e6ec989f285efd0dc19d2610ab6520fcce9bcbd","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"7e6ec989f285efd0dc19d2610ab6520fcce9bcbd","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1529017025751.tgz","fileCount":32,"unpackedSize":277888},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1529017025751_1529017037539_0.44948192785297314"},"_hasShrinkwrap":false},"1.5.0-next.1529019939040":{"name":"puppeteer","version":"1.5.0-next.1529019939040","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"567388"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"c430138845a44e20bff88b49843569f119e08d3d","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1529019939040","_shasum":"319e4eb3d4f2d56927e79b88499787d3033b7cd1","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"319e4eb3d4f2d56927e79b88499787d3033b7cd1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1529019939040.tgz","fileCount":32,"unpackedSize":277858},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1529019939040_1529019950500_0.5606976830447643"},"_hasShrinkwrap":false},"1.5.0-next.1529020277784":{"name":"puppeteer","version":"1.5.0-next.1529020277784","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"567388"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"af0bd15d88854dd8afcf258daea95eb0e91d1e45","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1529020277784","_shasum":"873b0f5033aa8ae475b108b11f01dd623f91029f","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"873b0f5033aa8ae475b108b11f01dd623f91029f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1529020277784.tgz","fileCount":32,"unpackedSize":277858},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1529020277784_1529020291986_0.47651109398204095"},"_hasShrinkwrap":false},"1.5.0-next.1529354619280":{"name":"puppeteer","version":"1.5.0-next.1529354619280","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"567388"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"b20cde67c63a6344321c2fc40ef2d3cbf8c3ae24","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1529354619280","_shasum":"77644cffb716f608eca1312d473e750629cd07f6","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"77644cffb716f608eca1312d473e750629cd07f6","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1529354619280.tgz","fileCount":32,"unpackedSize":277933},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1529354619280_1529354633610_0.11076315509403134"},"_hasShrinkwrap":false},"1.5.0-next.1529393801062":{"name":"puppeteer","version":"1.5.0-next.1529393801062","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"567388"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"f197d2e20880901af9a661395e703217f48fb766","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1529393801062","_shasum":"f36a4eb650abc7b545f830c061a0c4d80c175366","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"f36a4eb650abc7b545f830c061a0c4d80c175366","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1529393801062.tgz","fileCount":32,"unpackedSize":277880},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1529393801062_1529393815737_0.7407089066188952"},"_hasShrinkwrap":false},"1.5.0-next.1529429863153":{"name":"puppeteer","version":"1.5.0-next.1529429863153","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"567388"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"37dbfc2608435ccb4a5dc4384e49e4efc230ffff","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1529429863153","_shasum":"95f37a30b875de156c8a667c17ee34c9f438fbac","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"95f37a30b875de156c8a667c17ee34c9f438fbac","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1529429863153.tgz","fileCount":32,"unpackedSize":277880},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1529429863153_1529429874467_0.5821441464891086"},"_hasShrinkwrap":false},"1.5.0-next.1529430695195":{"name":"puppeteer","version":"1.5.0-next.1529430695195","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"567388"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"1064aa44767a56e8fb7406e581ea4a1679d557f3","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1529430695195","_shasum":"1875e58e0d9d0e75d958db1d14eb68d33cdaea90","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"1875e58e0d9d0e75d958db1d14eb68d33cdaea90","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1529430695195.tgz","fileCount":32,"unpackedSize":277964},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1529430695195_1529430705442_0.8423878113138319"},"_hasShrinkwrap":false},"1.5.0-next.1529438841250":{"name":"puppeteer","version":"1.5.0-next.1529438841250","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"567388"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"ea8ec1e567a8b1b7c34dfba49ccea927b43c2197","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1529438841250","_shasum":"c4959eda00969da833a0c9a8b34e450985252d6c","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"c4959eda00969da833a0c9a8b34e450985252d6c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1529438841250.tgz","fileCount":32,"unpackedSize":277964},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1529438841250_1529438857128_0.5397092439091633"},"_hasShrinkwrap":false},"1.5.0-next.1529441303045":{"name":"puppeteer","version":"1.5.0-next.1529441303045","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"568432"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"dcae6bcff49150bec2060667fef7bd7ab71db042","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1529441303045","_shasum":"3febc94d9688eb4b41196a1ad4cac33f9bfad6b7","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"3febc94d9688eb4b41196a1ad4cac33f9bfad6b7","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1529441303045.tgz","fileCount":32,"unpackedSize":277964},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1529441303045_1529441315031_0.7534033680191232"},"_hasShrinkwrap":false},"1.5.0-next.1529528205725":{"name":"puppeteer","version":"1.5.0-next.1529528205725","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"568432"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"a460114945f8f979e43655ce1e7b7b10daac5843","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1529528205725","_shasum":"a991133253eb9a36052247fb975911a5a6e69bfb","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"a991133253eb9a36052247fb975911a5a6e69bfb","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1529528205725.tgz","fileCount":32,"unpackedSize":277964},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1529528205725_1529528231873_0.5836980789889701"},"_hasShrinkwrap":false},"1.5.0-next.1529601789907":{"name":"puppeteer","version":"1.5.0-next.1529601789907","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"568432"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"3b20839ab5220768a7d38e0dec948c201b6a6709","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1529601789907","_shasum":"4b8e242d711f24c0b6502e5090abe6d8bd2427e9","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"4b8e242d711f24c0b6502e5090abe6d8bd2427e9","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1529601789907.tgz","fileCount":32,"unpackedSize":277964},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1529601789907_1529601801635_0.8961742096144991"},"_hasShrinkwrap":false},"1.5.0-next.1529602796106":{"name":"puppeteer","version":"1.5.0-next.1529602796106","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"568432"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"811415bc8c47f7882375629b57b3fe186ad61ed4","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1529602796106","_shasum":"ecde5b7576a15054f6d8bac32a078b85dd917566","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"ecde5b7576a15054f6d8bac32a078b85dd917566","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1529602796106.tgz","fileCount":32,"unpackedSize":277964},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1529602796106_1529602809544_0.17522889075467418"},"_hasShrinkwrap":false},"1.5.0-next.1529964776684":{"name":"puppeteer","version":"1.5.0-next.1529964776684","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"568432"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"aae73f5fd70fcd242ecf086a17db6802d54e3c59","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1529964776684","_shasum":"dfd45cce1fd6f54fb4f8e7bec866566ba9d4e09a","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"dfd45cce1fd6f54fb4f8e7bec866566ba9d4e09a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1529964776684.tgz","fileCount":32,"unpackedSize":278196},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1529964776684_1529964787413_0.4842560215644789"},"_hasShrinkwrap":false},"1.5.0-next.1530045933494":{"name":"puppeteer","version":"1.5.0-next.1530045933494","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"568432"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"6ca43cf76187a33c62d8822fe363196bc3ebd216","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1530045933494","_shasum":"6f9854496302d11f6c4fc4fef32b14491fe848b9","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"6f9854496302d11f6c4fc4fef32b14491fe848b9","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1530045933494.tgz","fileCount":32,"unpackedSize":278196},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1530045933494_1530045946109_0.4595156429152665"},"_hasShrinkwrap":false},"1.5.0-next.1530061507172":{"name":"puppeteer","version":"1.5.0-next.1530061507172","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"568432"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"d6741eca083cf20a2debd78ed43e7c257b217b0e","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1530061507172","_shasum":"6c203d652e6bafcebdb3ea9428a54ee4adac369c","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"6c203d652e6bafcebdb3ea9428a54ee4adac369c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1530061507172.tgz","fileCount":32,"unpackedSize":278521},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1530061507172_1530061519001_0.38301823963631"},"_hasShrinkwrap":false},"1.5.0-next.1530061501767":{"name":"puppeteer","version":"1.5.0-next.1530061501767","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"568432"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"f55d005cbea407f5e9baf7d6fca251ad71873b65","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1530061501767","_shasum":"5b3b58673535216e67f7a37852e0cbc9c09515e1","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"5b3b58673535216e67f7a37852e0cbc9c09515e1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1530061501767.tgz","fileCount":32,"unpackedSize":278521},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1530061501767_1530061520963_0.2771939629228166"},"_hasShrinkwrap":false},"1.5.0-next.1530217505079":{"name":"puppeteer","version":"1.5.0-next.1530217505079","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"571040"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"c4acc637759dc5a7d2c84b553dae12d41654e518","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1530217505079","_shasum":"e4331ad69d642c3b5e9c0a8b4590efeb0dc6702c","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"e4331ad69d642c3b5e9c0a8b4590efeb0dc6702c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1530217505079.tgz","fileCount":32,"unpackedSize":278521},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1530217505079_1530217516213_0.9577655672082912"},"_hasShrinkwrap":false},"1.5.0-next.1530237072145":{"name":"puppeteer","version":"1.5.0-next.1530237072145","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"571040"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"871b204fd130bb6531b4e3fe3d58b95e534a4b43","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1530237072145","_shasum":"e9640561adf3db58623ada988c282a5f856f0764","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"e9640561adf3db58623ada988c282a5f856f0764","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1530237072145.tgz","fileCount":32,"unpackedSize":277447},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1530237072145_1530237085629_0.7813855743861511"},"_hasShrinkwrap":false},"1.5.0-next.1530291793909":{"name":"puppeteer","version":"1.5.0-next.1530291793909","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"571375"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"59e7f7ebb61030cd8462d29b8960c93114199540","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1530291793909","_shasum":"76c1d649316a6657c393aafa442e841e06389b8d","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"76c1d649316a6657c393aafa442e841e06389b8d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1530291793909.tgz","fileCount":32,"unpackedSize":277447},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1530291793909_1530291806836_0.726566129553889"},"_hasShrinkwrap":false},"1.5.0-next.1530299145196":{"name":"puppeteer","version":"1.5.0-next.1530299145196","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"571375"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"5955affab025bdc9506fe47485b0e6c0bacaa828","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). It can also be configured to use full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1530299145196","_shasum":"74f095ccb134be6ec1031bacf48d3b36d7f4561f","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"74f095ccb134be6ec1031bacf48d3b36d7f4561f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1530299145196.tgz","fileCount":32,"unpackedSize":278266},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1530299145196_1530299157366_0.07204652966106284"},"_hasShrinkwrap":false},"1.5.0-next.1530333501924":{"name":"puppeteer","version":"1.5.0-next.1530333501924","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"571375"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"fb7c4e09849e8c21ecdeff406d839fafbc4a8631","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1530333501924","_shasum":"68c76e973da22b0f99dfe486e2a370723fde45a0","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"68c76e973da22b0f99dfe486e2a370723fde45a0","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1530333501924.tgz","fileCount":32,"unpackedSize":278289},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1530333501924_1530333513472_0.12486720580605182"},"_hasShrinkwrap":false},"1.5.0-next.1530747584201":{"name":"puppeteer","version":"1.5.0-next.1530747584201","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"571375"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"22fa00a7b369b8d8614e29e0ddb6aa7345a6a1de","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1530747584201","_shasum":"86085c85671da2841c491761c06e37806991529b","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"86085c85671da2841c491761c06e37806991529b","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1530747584201.tgz","fileCount":32,"unpackedSize":278288},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1530747584201_1530747595332_0.4530378066778262"},"_hasShrinkwrap":false},"1.5.0-next.1530747678469":{"name":"puppeteer","version":"1.5.0-next.1530747678469","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"571375"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"cfc0571c1abba7a5597bd59441fa588ed59e6cc5","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1530747678469","_shasum":"bb02b86279a92e53dce51c2072cf87a5fffc26ce","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"bb02b86279a92e53dce51c2072cf87a5fffc26ce","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1530747678469.tgz","fileCount":32,"unpackedSize":278337},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1530747678469_1530747689222_0.3578410819276543"},"_hasShrinkwrap":false},"1.5.0-next.1530749057441":{"name":"puppeteer","version":"1.5.0-next.1530749057441","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"571375"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"eb53a8fdd09c473ef6ce96696604ee8ba1c952bf","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\nPuppeteer bundles Chromium to ensure that the latest features it uses are guaranteed to be available. As the DevTools protocol and browser improve over time, Puppeteer will be updated to depend on newer versions of Chromium.\n\n#### Q: What is the difference between Puppeteer, Selenium / WebDriver, and PhantomJS?\n\nSelenium / WebDriver is a well-established cross-browser API that is useful for testing cross-browser support.\n\nPuppeteer works only with Chromium or Chrome. However, many teams only run unit tests with a single browser (e.g. PhantomJS). In non-testing use cases, Puppeteer provides a powerful but simple API because it's only targeting one browser that enables you to rapidly develop automation scripts.\n\nPuppeteer bundles the latest versions of Chromium.\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: Why is the Chrome team building Puppeteer?\n\nThe goals of the project are simple:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\n#### Q: How does Puppeteer compare with other headless Chrome projects?\n\nThe past few months have brought [several new libraries for automating headless Chrome](https://medium.com/@kensoh/chromeless-chrominator-chromy-navalia-lambdium-ghostjs-autogcd-ef34bcd26907). As the team authoring the underlying DevTools Protocol, we're excited to witness and support this flourishing ecosystem.\n\nWe've reached out to a number of these projects to see if there are opportunities for collaboration, and we're happy to do what we can to help.\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1530749057441","_shasum":"a4ed5c31ddaf48ab41e45561935ec08be65b4ca3","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"a4ed5c31ddaf48ab41e45561935ec08be65b4ca3","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1530749057441.tgz","fileCount":32,"unpackedSize":278337},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1530749057441_1530749068662_0.03606497711958512"},"_hasShrinkwrap":false},"1.5.0-next.1530771453419":{"name":"puppeteer","version":"1.5.0-next.1530771453419","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"571375"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"9313c83ad24eedb5ecad5e83fb8ede689fd29733","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, then no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154 \n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1530771453419","_shasum":"c1e027acd707c1d9f4d61d12701fc0ce0e73d79b","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"c1e027acd707c1d9f4d61d12701fc0ce0e73d79b","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1530771453419.tgz","fileCount":32,"unpackedSize":281656},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1530771453419_1530771463800_0.49103320846928744"},"_hasShrinkwrap":false},"1.5.0-next.1531162744899":{"name":"puppeteer","version":"1.5.0-next.1531162744899","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"571375"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"88362f710f816a17d9336cc16f17004eb941a76b","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154 \n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1531162744899","_shasum":"18c36eee295ff378ac36c2d4a2407977ebdc9fa3","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"18c36eee295ff378ac36c2d4a2407977ebdc9fa3","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1531162744899.tgz","fileCount":32,"unpackedSize":281656},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1531162744899_1531162757400_0.1764475990740617"},"_hasShrinkwrap":false},"1.5.0-next.1531189632656":{"name":"puppeteer","version":"1.5.0-next.1531189632656","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"571375"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"e445e1c8b83459f1cbfca059effad6f1b9d5f924","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nCaution: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154 \n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1531189632656","_shasum":"e6ac5db820aa0bddd86969550b8d39385561ec54","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"e6ac5db820aa0bddd86969550b8d39385561ec54","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1531189632656.tgz","fileCount":32,"unpackedSize":281656},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1531189632656_1531189651838_0.37344046383118457"},"_hasShrinkwrap":false},"1.5.0-next.1531354198653":{"name":"puppeteer","version":"1.5.0-next.1531354198653","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"571375"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"4f8d00e64ef895417941262259029c0a28e1dfa6","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154 \n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1531354198653","_shasum":"de2a57dcd26e063d36a94365537f8c5f60168cdb","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"de2a57dcd26e063d36a94365537f8c5f60168cdb","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1531354198653.tgz","fileCount":32,"unpackedSize":281653},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1531354198653_1531354211901_0.4225059275965637"},"_hasShrinkwrap":false},"1.5.0-next.1531356790849":{"name":"puppeteer","version":"1.5.0-next.1531356790849","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"571375"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"96c558d54461e84b41052d144c74a4919dea0b1a","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154 \n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1531356790849","_shasum":"130185bc531d810ce47fc5f606c04b725ebba245","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"130185bc531d810ce47fc5f606c04b725ebba245","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1531356790849.tgz","fileCount":32,"unpackedSize":282085},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1531356790849_1531356804291_0.7466665170447333"},"_hasShrinkwrap":false},"1.5.0-next.1531359649065":{"name":"puppeteer","version":"1.5.0-next.1531359649065","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"571375"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"12bc1e1a62001660d4dcc6f83e6ae6ac28bce601","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154 \n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1531359649065","_shasum":"4a290b123c004160bfde20c1b4c6a541b9202298","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"4a290b123c004160bfde20c1b4c6a541b9202298","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1531359649065.tgz","fileCount":32,"unpackedSize":282913},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1531359649065_1531359661193_0.016221820787378993"},"_hasShrinkwrap":false},"1.5.0-next.1531368423225":{"name":"puppeteer","version":"1.5.0-next.1531368423225","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"571375"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"254bc80811774007125c48ad012cc8cd90a5efec","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154 \n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1531368423225","_shasum":"2518a8a32128a1de945103814c701a3baf47aa4c","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"2518a8a32128a1de945103814c701a3baf47aa4c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1531368423225.tgz","fileCount":32,"unpackedSize":282929},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1531368423225_1531368435534_0.2220722325091644"},"_hasShrinkwrap":false},"1.5.0-next.1531368496280":{"name":"puppeteer","version":"1.5.0-next.1531368496280","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"571375"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"3ebbf125ff3332f5d9aff204cd20025b3a6fb9a6","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.5.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n \n jest: `jest.setTimeout(100000);`\n \n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n \n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n \n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154 \n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.5.0-next.1531368496280","_shasum":"aad0aa2e1b75285ddfed28ec60fb83755c6fd7ac","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"aad0aa2e1b75285ddfed28ec60fb83755c6fd7ac","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.5.0-next.1531368496280.tgz","fileCount":32,"unpackedSize":283023},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.5.0-next.1531368496280_1531368516017_0.22364363214326133"},"_hasShrinkwrap":false},"1.6.0":{"name":"puppeteer","version":"1.6.0","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"571375"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"3762de7b91bb85d2f1979d49152af79a92a06bbd","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.0","_npmVersion":"5.6.0","_nodeVersion":"10.2.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-88epdIp3lw0LxI+sIHgdgZdq/u5zRnzgU2vJGvcyuGqHQrtRUeICTexTyT1KoKhTGG0mAKFRV9c7IJ179agm7A==","shasum":"b6b6bd6a063a0b7591258613ec89a135f2cf8f2e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.0.tgz","fileCount":54,"unpackedSize":599124,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbR/NICRA9TVsSAnZWagAAER0P/RKfjPFSwgk3P+rwInYy\ncOKYXrpfwvE+6ivSzY/9nHsWtL8a/8P1P3eyo3gUa3UHl138QfOb5Z9/RyAu\nvDPOtBexkYztT8NgmtB5hqM62haTITes/GY9prOK36gF+7Kjc2cfwUoA9jFt\nwEb+Uv3B8K6g1ZH7YYhFrwsjPB4Kx08aje0omNY8/jzaIhr38SSFQwQuDNT7\nJchCMpq1qciCw/CnbJasUGwe9mQyty1RPb2GsSsWpcTD2bJyjgw9oJk/cJIc\n+aLKuosilh2olmh9F3pyrMV1ilf+JNh6Xn8KoI+BNOXEOKHnEoHOOdwDi45x\nLU84hZvyd1gbzfTcSm2fdh9lwmHiaya8wCm93qc56zE3IYnDnpYTS75o1mdn\n401Tctv3f66fr21UESq2ucEQgIxWR5hXI4qF3k/rW1TBsdwgZ2SLeVZ7UpxP\nFWh7u9rBbDviBFyTeglQu6HPa8zqUMX0wYazWqLNFR+y7VFlp5pRIca3o+8i\nnqi7z0QG+PJZE0W9VOKg4bw/3l+B6HmEtT97ivLgjiDVeA3k3pv8vJFjl7bN\nP1XB9jmBqUHb1Wp1OwvIVj3YLzwg5FL4SHiF983m7hv/jAqY+W2xJcG2LkrL\ninxyBOFq4Z2I4NCh0jIxYnQh6twsd+HHs3k7dcRDEXUcdqd+FUKxukiJHVqh\nQhsB\r\n=Xd01\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.0_1531441992477_0.835726787932203"},"_hasShrinkwrap":false},"1.6.0-next.1532381444032":{"name":"puppeteer","version":"1.6.0-next.1532381444032","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"574897"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"aa57a873cf9721a528a3dc6f1d36632e1341c18b","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.0-next.1532381444032","_npmVersion":"5.6.0","_nodeVersion":"10.2.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-pBCBdCCqlc1Gy/rrSutm3Cnf8nOf7t8EMKBYuGI4zDAkquDKdeXkg/eaZLPv/3OZZjwXpvjVbyUyCyWu3ojKsQ==","shasum":"c8255be305e76d97ec2f62fbf1ce01688a82e14c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.0-next.1532381444032.tgz","fileCount":59,"unpackedSize":629506,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbVkkNCRA9TVsSAnZWagAA728P/2tlT3hd0UNcARmpd5Lb\nFmrXHnHAo6E+2JtvtmDnHH5xG2ax+5GP3K1yt4M2/9hyn/ri84qZ9RrQRZUe\ncdglC1koddmSg452Ekh/0F6dgA7brXiCK4SZFcJui9+7VOzzhq5KI06nbB36\nNVokPIHjj9gySbS/jP1S8qyaWxd7DeZAeWWQ9whfrXzVUDZQukVNN/NLop6d\n9hvnD2GLSA3ZQQCnc6JppvRlzGtgckCejMImdns3jtZB6Q/QjQhFMcLKCHa2\nmgnPHNfsFqsGzFBRv4f+zvsTtd+XPsyHhUIxmJimX/rSR8NsAQVkobNBrtVS\nxZxC9odO4h3PYc64+MlVGAmeqoOOjEtrredpONNYLq7Hb3M6Mm1uv2icf6sp\n8+Ux0hQZc2iFjcTcClNVne07+4FwNovibpVFB1Xmacb2BZk+JoHpkhcirzlV\n+E2VrZn7ImJxbtaCqA90Ae/I5+F8EQSBImWTLcfcM7vlacJIEVu7bHlAkzv4\nViGg6S9qt/xV+wFAfBKXy8xv+yOS9NbHeZoISEUCPAAZuBQEBSfC7EfqE5if\nrc4lho2t6yv1g/Qa4xN13BU+XEomWykJXDLVSTSaOTnJd9E6M9ADGlapSQVk\nGVrRATOZ1QGbGRHejoLa+j3uZNTvZ+bDHmnq8n/9+C9Jqq4zQP9Df9Q9KFjk\nZ0vw\r\n=KOi3\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.0-next.1532381444032_1532381453015_0.7804774505828571"},"_hasShrinkwrap":false},"1.6.0-next.1532390828888":{"name":"puppeteer","version":"1.6.0-next.1532390828888","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"574897"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"5b1898785b169e4d6e7bed5732f61cd9f6d77101","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.6.0-next.1532390828888","_shasum":"4e31dc254a2b563bedbfd6ce221619920e08a9ea","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"4e31dc254a2b563bedbfd6ce221619920e08a9ea","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.0-next.1532390828888.tgz","fileCount":32,"unpackedSize":285568},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.0-next.1532390828888_1532390841025_0.48040311845524686"},"_hasShrinkwrap":false},"1.6.0-next.1532455573607":{"name":"puppeteer","version":"1.6.0-next.1532455573607","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"574897"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"ca99a67aadf883e38c8d031a2068dff92e91251a","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.6.0-next.1532455573607","_shasum":"f967426aa0889f8bda7c2eaab6a4bde5bf03362c","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"f967426aa0889f8bda7c2eaab6a4bde5bf03362c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.0-next.1532455573607.tgz","fileCount":32,"unpackedSize":285538},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.0-next.1532455573607_1532455588151_0.37471041593702337"},"_hasShrinkwrap":false},"1.6.1":{"name":"puppeteer","version":"1.6.1","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"575458"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"0a4f24a94c474afecc802e98764ece43f7c5ca41","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.1","_npmVersion":"6.1.0","_nodeVersion":"10.6.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-qz6DLwK+PhlBMjJZOMOsgVCnweYLtmiqnmJYUDPT++ElMz+cQgbsCNKPw4YDVpg3RTbsRX/pqQqr20zrp0cuKw==","shasum":"ae50021bf8b2172be8f8d79224bec215f1a0c7c7","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.1.tgz","fileCount":54,"unpackedSize":599064,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbV24MCRA9TVsSAnZWagAAO2wP/R/Owj76eikZe3FQrZPJ\nrGIcCRdjELeXr4O6pmSCejTHHZwc3FXEhFQGqcuvjOV/q5bKZvvB3dId0FpB\n03Ga6iCkaocFqA0hZFgEjWYOmsQ+yAUwG7ub0ZPRF8RDJNHifOqGHyDBppc9\n7zJmvJQvB7dj0VGlgF4GNo6utVHHWbnB4xBbpJOTfL3BBYQlgCxZNb9jsvyW\nBMlzQHGTCu04mT9wYfzWsgkrIqhZYGntz1h4O6BDydNrIdbDyjpC251T0ATi\nyQsxNAhU6OVMmjTQJxKQHYbLc7mr+sIJJVKxahAlVtuF0hdepVys0mN2jf2X\nFByEbLhZXBgXBIAGjiuzcDtZX6yP5yJmPmDPRCh37yDH9kT3dmndNhujxgh8\nYLHH/geS6Sza8U6n+qcqOIBIyFw1wRR++OzPqdpfJEWmhZbzbzrrXfuz/AFb\nJtpt3h4RlvKK9N4FF/BV2XNItX47w1P3NDez4q7EU9gITbjkQyFq6MBNFbms\n55VT1qdJJU7jmJOQU/sXGXBqw8ot+PvvfxbJOV+JpvtmiHXWtCrqG7c0aEjA\nhpBGHIBE0dCajn1hikFVy0vKhKnXYjunVG1VoFcJQXMmUK6EkzHPt0XOcGIf\nRveeTSCjkiGlCSK3eMPIOx2NPAhDfyY/IDvQNgcCbB/dSiv8FEm+qmZkktEs\ncNh3\r\n=sXhZ\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.1_1532456460092_0.6993230916855804"},"_hasShrinkwrap":false},"1.6.0-next.1532647628942":{"name":"puppeteer","version":"1.6.0-next.1532647628942","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/googlechrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"574897"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"3d12f1f279ee827afc1c5ac965f6b15b4dfcc07a","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/googlechrome/puppeteer/issues"},"homepage":"https://github.com/googlechrome/puppeteer#readme","_id":"puppeteer@1.6.0-next.1532647628942","_shasum":"319bb2606c5947bffd5c0620ccb13f22a91bc875","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"shasum":"319bb2606c5947bffd5c0620ccb13f22a91bc875","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.0-next.1532647628942.tgz","fileCount":32,"unpackedSize":285610},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.0-next.1532647628942_1532647642369_0.0759376927141171"},"_hasShrinkwrap":false},"1.6.0-next.1532974708417":{"name":"puppeteer","version":"1.6.0-next.1532974708417","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"574897"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"c5fe1dbdbb49c4a348cbe996bb7e87cc276c1145","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.0-next.1532974708417","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-nSmlP2ouZfrUd8U+AlKRdrZdo0nclI/0aJM9Kc3rxs4O8dg9wFCCm8oun37nnnj97hjKAj4mmPgVIxFs7X3Whw==","shasum":"638295c49dd5c7cb6671ebfeb1b114750b493211","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.0-next.1532974708417.tgz","fileCount":54,"unpackedSize":600484,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbX1a8CRA9TVsSAnZWagAA0EAP/2y8aIAT11zxZdyXs3fG\nglV8ZyNy983yI6KOcdUjEb4MKbcs2FG4adIf5NnlnFDuCp+kzk7FgSFHVHI0\nIf+/ju4oTq70e/txpp6cnaC0LlOvpO6wC+U+M55Hf2GIRvecs5qvXNTsxJev\nWnRGziNoBEqIqGARPLLdJoU2mW7DGg3+kD3qsxsko1tODMJWG1/anBlwTsXF\nnjikB2VfheWK8QgDd/8JCP47+JVcXcM5lf+50K32RqEkwORJrOWGX117ZwTH\nYdX7UgYqulXjGmWTnb/B8VTOaYQcxE5vvlNg9bWBTvG21eiZKRBFy1ECoYcR\nC5TlzQa2fMZb2LnE8SnmfN3jXz3dmr2ylewAN4mqSDZX4soVHlGcsaz7TVGf\n56/kw3Hka65qaeeC3cfth4RoUGu+s/qsdgz1XFwyWb1I1Oee+RRyXkUkeLzA\ni4IzBdp2Dp8+AcGpUzzhPM3/zxQsuS1y01vLkICOV8/VI66feDq2bsYa0l4C\n7/tJU2JkkvPfXU8b/SwaMLafZEyaFYL8Lslv23Efh+UzApc/uS/4O+UTnYaT\n8W/83Zi3/zkJLaJf9L26T0JkmPSWalHH4GJNhfyIwRbPq+lMMqPtPs2WIMru\nTXp8VW27c/JqFamMLx5ZlALq58IuUxjUNoQo58rut2OLevtGLxxBTIHOqaTZ\n8V48\r\n=iE98\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.0-next.1532974708417_1532974780246_0.4427469616850219"},"_hasShrinkwrap":false},"1.6.0-next.1532994218655":{"name":"puppeteer","version":"1.6.0-next.1532994218655","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"574897"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"392d3b94bdd1f37d70b201ea19ee4f73844678ec","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.0-next.1532994218655","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-J58oXST6g4JS7xpsmIR5Kv36vS3LcJ+yi2eyF1MjKD/o8A2SgCzyNgpbAjThRMV3WzLabdzBzH7i6MVKQuE0rw==","shasum":"db700df47edfa22300c59532c2bdfd908d0f74a3","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.0-next.1532994218655.tgz","fileCount":54,"unpackedSize":600366,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbX6K0CRA9TVsSAnZWagAAHlsQAJHVNsH+RLWYttlfSiHc\n7w5hAYFyIz4S0Gd69WyZelATX3W2jzC4d7PUyDMZpAcWrnBD8eOy3wHeUn3o\nA7Fi9ERUhPdA8bY9NvHzayEWBZvEDt0xAlbKdwQN6z5w+cXPbn/e3ACAFmnx\nPvv0wLp2bvw4TFen6bVuSRWeI9hSddOS46rIZQCJvGJLAuYPfjasaWtGLcSK\nvM0y5286u6Dgmv3aV/W1wRqQzPxGc8RG8W5z0KAj9NsmOpYsVXVkKb2KURd2\n6HwnFdg+aiP37N4kvtAfm8V5OdO76wXY5vx47PBhBv4pEKfHomHEBVJcg+px\nYaCVkgCVKycZLcrPcuO9aa1NrtV8TLXeRWqIi+9xkeGmrcLb0Jj/x8YAlh+Z\nrypmzYth8n2a2DwRO8/wbYb9L+FhNUHK9SL7P4v/yQR6BIAJFmf+WEVEZoju\nS9qPfl3r9sFusiCBRrHT1iQE10Xdjc2wKR5IChyDrBAiDlR3Y5w35faeHv7o\nM/W3QL4lQLDVDCMHF9nWPYn28mwxb8shQDjY/WaKavJ9C1QcMpoAxngd7rwm\njo+h9lQ97RQOX6xrEv7443QCyuizjHe3tcZmKj+dAWHXLX7eS0YmhG93ApOh\nqfEq1Ph+oRC0X0IPOtNUS4vknkb2S8eUg16tGn7MoOmzxOqO+VxOOB/LRDcu\nmNfT\r\n=hTAk\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.0-next.1532994218655_1532994227899_0.30099241423635026"},"_hasShrinkwrap":false},"1.6.0-next.1532995736465":{"name":"puppeteer","version":"1.6.0-next.1532995736465","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"574897"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"0b12119843f88a6d560924ff52b6b99e8f6a7cf6","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.0/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.0-next.1532995736465","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-SXcP7DsPUklhxJ0wamkyfb5G0OIMCar+va6lZEroiJNqFLJEIzswlDET6atCcsKVyHsHkArg3tJ3uQoP0s++hQ==","shasum":"13dae8175f8c2e71236871d01c110770673dbcc7","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.0-next.1532995736465.tgz","fileCount":54,"unpackedSize":600412,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbX6iiCRA9TVsSAnZWagAA0f8P/jRADihzaECkWM21JG/t\ncAfMuJOA6nvrTeI2Q5jrWuDQxwY7MoWsW2xtHhk3Hu9QTLpe+sIC4W/BbN7w\nPKD+8fTeu0HqmZfAkwXUH+UcZrDMnCo8RxqIF86s32O4FLWGNOw8ANOfffHL\nDuP04S/Z49+5HcEQ9jep+XhdvZqKlF/0YGsbAQdaDgCFQ/W9hcit51Z0BUJF\nKwVkDUJm1DQbJ5wFzhX0sMbF+czIgny6pp5kIMk4LKm0N5q/bVlVv4CF8IiW\nSoos42MFuS0/UbcdRi4FbM2F7cX8FkZZ4cryYxmz+xyPbCL8Ses9Xb/Bp2/w\n2e9i070b4mbcZqgL7Nb0ezC1Zr99Hnh7bS4mKuToOSFqI9pZLQjevz+1NY91\nT7Z7FQabZ1YSZI7p5mRmMFvULIS3kgx25AkZf2QDgnMl1IIwh8RrR0dOOvPa\noCO4NxOcK1Eb9xHkOLv1bQzePEW7uU1yWoNJZD2FJZDmFO6PVe93ctLK2aeR\nWgCAk5DK5lPWR0ljV8npOieplImE+Hnrh7Si/oQfvxiJDvAD4RLBb4IQpG/L\nQWFGMFzKV/lwX4+wCvki43jvk5dl1l6vKp0kNgQJTXf/BKrer2iOUhoip/aM\nzwsVPPisDRoL4tx0jCRrJkgoQqQ1Mu0KUeskX8+6tE+cFi4r13h+LMlNLZhg\nB3VJ\r\n=hr40\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.0-next.1532995736465_1532995746180_0.19186504445145736"},"_hasShrinkwrap":false},"1.6.1-next.1532999286971":{"name":"puppeteer","version":"1.6.1-next.1532999286971","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"574897"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"d305c7d8c1dd40a923268eb5665c03342202a523","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.1/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.1-next.1532999286971","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-qpaFOwWeM523a7D2lUmvtRqTX1CvTTVmdeiTLZ1xdsXY0LvvZV/xBC08cUNR7CcudH0ufZYYueL/o6OigG5DYw==","shasum":"9beac837c149692cfcfd0b76a827ff800babb4c9","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.1-next.1532999286971.tgz","fileCount":54,"unpackedSize":600412,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbX7aCCRA9TVsSAnZWagAA06UP/1OXHGPIFptQrxhAWSVD\n5rBTn1sUDqIQhItBJRZOaeU/e8LQ8/DdGRTbUJqccDUzXrW/aFZWKP8bU0I3\n6xhy3zV6Cl/S96NZyvltYoLupSHpez8Y6bYv52ymvyn33W17O+lDJsyyvB9y\nF5GebqHLc0inFcZ5OJzDYyXJdIRYXN7pUUK49+K7AHPOgi5j1d49LixeH5vU\nj6BdL8INUa1C2s1I2A+8BAxCD7uCwkEF41rzpplODc2YxzJfgViXJicLWArm\nC8zhoea7mVTDpNIpF1MZ24iXrNeFDtu5+EQaAJW1nAnHy/J8ZqW5tESZWO9m\n/OMOmr0+QoPiPkwl6lt9XwSKmN8Iz8zZMDv9BpbskKsIl0tIQf3YRhtbj9n/\n0A8GOaj9T98H41YzOiS+d/PFQg/NCM0mWX/MGwJdQ3yGtG7ANRKGy8YvQpWU\nWR33cawk0FwlhsbVSj8LXyjqzQ0AEUjJ01ldPPyxilAaeAZ9J+88Dgh5wVPD\n+psslRLQYNBkj7Vc5AXOwr3f8FQz6kiuWrD1qnVLouATulAb2I+wJp1NjRu6\naAqt/obzdwMaXaf7nA1YoFtJxRjkMh+s71hvPycS1lBFyBrO8d7hNV5vMFKN\ne1W27cIP2Vep9i0bhw8HJlTreMfUoIAi4yPrYyi7nk82ucMmYp+3EC6A+ApM\n+lQ1\r\n=Sjmm\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.1-next.1532999286971_1532999298332_0.17387577096313112"},"_hasShrinkwrap":false},"1.6.1-next.1532999303060":{"name":"puppeteer","version":"1.6.1-next.1532999303060","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"574897"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"2c9599496aae044d496209435a4e761bbdead140","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.1/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.1-next.1532999303060","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-UdZcl1Ywy25W6gJsG6mXtFwrzf4i7clLeZJPVY/yE3m0fZl+WqFmIDlIbyKGLOb8W2VMlLii+LVJcmu5ZET5/Q==","shasum":"305d591e87c8993375442d799345da7108873fe1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.1-next.1532999303060.tgz","fileCount":54,"unpackedSize":600412,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbX7aVCRA9TVsSAnZWagAAaBIP/iXQ1w61qSe/EQTSMQG6\nfse1e9dlGil8FVX478rUxb5Kx98sX0wWWYxdyIRbB4AVMwratSH+ybbQ+dXv\nBZV2j5hX8ymkzl1Dac2SQBZtIVSxhE61QAl1nDKuISwfBicpqwhVaalTnvQG\npo6VK9XxMqV0VLPsG4j9p+wcU1upOVKodDUJLxe+v+7CTLu1/CbLGco0EcIM\nXH3EUQ60tHp4saED/2Qt2i+K3VuHbd652gFEFsb2bwqbnM9uqEBb5MGB/XSL\nLpKHIldGHDFvQWF3WRJBkW6bq3eGq7h4+4R12V6qyaidJtnRVAOedtDbeczm\noW4xmPIZrss6Wx4wOUhh+STDfbnPyhStVJby9UBD4Id1eaTkUizpL8yHy+oh\n25TzrUZecg59q9VHt31u/hdWBoj3WfJN6fjYhIMhVE78cDUrtrsOVg7AR9wy\nrAOcYhplZDhO87tQo2x3/PGNU6pMgPlLsP60M8n7H+er+WwJGl47gGkELGaL\ncMm1wwVDjTheOlmTZYi+zABuOMhgUPuwpumYiwI9v/C6CZpamkiTuwasKPoP\nROjgPZyGOby7PLhEv9i5FZJdG0TKKQ0wJ8saxzK0N5ofUxjZ2oiX5Kt4t8PK\nxLpKpn/+iO5sUqZBQ3pa/YHk09F8oK9nKhK2v+kEEgfBIGlKQNznDhMcgCqA\nsw37\r\n=rmz0\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.1-next.1532999303060_1532999317627_0.6131763830702317"},"_hasShrinkwrap":false},"1.6.1-next.1533001132257":{"name":"puppeteer","version":"1.6.1-next.1533001132257","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"574897"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"0c825de1f8d4c77251385fb2423428ac79f795b3","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.1/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.1-next.1533001132257","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-Im1c5I3OZOroXPz8L1vxTxafVJ+sq8ovGm1T6dvdAK3YymeMAlPQHDqucqfuS6zbInP95X916KIAFCz8FPsJLA==","shasum":"2bf53aa5ceeb971988a759cd09c5c56629805d1a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.1-next.1533001132257.tgz","fileCount":54,"unpackedSize":600412,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbX721CRA9TVsSAnZWagAAZqwP+QHoR7F0o5WrHpCcw0Ck\nJ2uYIEL3wm7uoUmk5e1IupEqshHogA8tF3wDe+FGCbdjdRULQAaF6HApBR3A\nH3IQj+W4F1jhTjnndl4UcSGIylyq1K9hZOdwF0tD+x2q0mhgpEIQiocexlZW\nk8iaJglWbUvXtTaPIr7k8x6WstrUG0a6dm5V6a8583RgaXD+BP0We6A1K2vR\nyzMFZ8/paqz4unrhCWmCVQ4iVswcfkFMgFBN9HT1FH71yyMyHiE44yzrWKbv\nv5L0wn5EL2/ZrFeFo5yM/+AVxa5WrEWLyXJmAVMcLhXBcgz1pXSgPvLCegfT\n5arsALyym3LRX08Nv/q4rfjjNXUEVcB0yyODU2M8rBrKiMHGzMdxt2o0CBPl\nDAH+Puq9ze81G8RzloUHCC9vrnEAfqIsx2nRPwnzSl+Qca9YuwDrijXrtsgs\nem+jKPJxWnp18NKqiVF/PYlYQGhEZQ3bYEmcC1gXS9tQ7prXrP3OPLwfcDgE\nQ4qySI6+eblvo0k8f39Y1KJ8gjv4qHSp+RuTA5AqengOUeuviSYTaBU2d1bo\npxyjwbE75a4ROCQIy0QWn5J1TLc4IU7528tdI4995Mm7pUQ3KqDkfTvnj1BU\nVtrH1kKInd10uRRmRhc+qaMjzFtnQU39+QOhVp9lDW/eiJydLRSm6yCJVbOO\nd+iq\r\n=R1JY\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.1-next.1533001132257_1533001140875_0.4365526340171728"},"_hasShrinkwrap":false},"1.6.1-next.1533002407095":{"name":"puppeteer","version":"1.6.1-next.1533002407095","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"574897"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"862ad96bdeb28931fafac0a00cadf01f089ffcd3","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.1/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.1-next.1533002407095","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-fQhh53ocKjJFeLuZxapy8tfiIGtUs+aBoEywoRkPHkJgd/AwNJ2DV1B4g+rjxM4XN2SHGUYnKP+WOcHgGid47A==","shasum":"2d90de7ab72ce9fd85a33a9e983da4b74165a56d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.1-next.1533002407095.tgz","fileCount":54,"unpackedSize":600412,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbX8K4CRA9TVsSAnZWagAAp4gQAJOxSzsLJ5fMVDnfr/2H\nCKLQbWkIyveBr3rtySpRny92MJ+q0/M77q8daVg4mNXh4+WSWcZFXTtiNGD8\n7U4Hy/E2Y9B8dyUKqc4LrM/1+9BkHQ1HHZsEfdbNF1AnzQt9yARr3yx2ndn0\n/FbSz9sjA05Y3MMz5DZszmlrzJ4u44mopCXVr4aaVMKj8lUsexpOmf0LER9O\nhK2CsOm3Cmok2aR+FVPPmOWGHJj4dFOy1reJWfOMTHsz+NFq1dxFYou1PnQ1\ncur21yHdmuZaYrJx4Lkly5Pq5SvNie5Xl0OpHD1dx1D94C710C74I1ESShJ8\nUOX5YIVpIXwxPyi920jdX2dLCSbW/ZpWiMSg3NiDQUq+IpE6wSXHPVpq5M1I\nbPDPCVXVlO3DfYybBqwuX83hxS11nauFX1rjrvZVX3RzeGAuBN17ZOi2I/e2\n578Ss6zKZ4YUcYTmfJ6ZkXRuOjgWaC4Rjd4gsunxIQAwDh95/RYb37rivvD4\nowCf3NQcR/Z+WKnXOvOAGPTGWeAz2uLrNbP9I9NsRrOCO8cF4GQMv6I/0X1c\nr2imfI+LG1g85lmd7JmCUb4yMcwXR1fXrncZ+TdMhmoxKjJYgvuHwN5JT+PQ\nDIKTIKWRBKOgYlHH0jA50OQdhiulXg4IviAmY6xrqKIIm3u5Kkh/VMdCYxrc\nPQSO\r\n=kcGR\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.1-next.1533002407095_1533002424063_0.5215689062928921"},"_hasShrinkwrap":false},"1.6.1-next.1533002862716":{"name":"puppeteer","version":"1.6.1-next.1533002862716","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"574897"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"5bcb7cf512c8ef73eeae129e143f8ca57e11bc8e","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.1/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.1-next.1533002862716","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-+FyOOlQ9+z2lJcCNiwZaNLJ9b0Nl14icO+AOMMSVcX4SPNsBuy/nd8mH3LkutIplg3v8gY/X6yzSXkjkReRT/w==","shasum":"57c35e29d4676fffd445957c0eeeda025ae0b082","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.1-next.1533002862716.tgz","fileCount":54,"unpackedSize":600412,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbX8R4CRA9TVsSAnZWagAA8SoQAJCW2UYC83xjtQCikoHm\noKo267pA/AxO+StLoRSYR8Sa+vEfECocyB5cn5vcH+Ku8kCYs5xcmL94oCtt\n6VUwzt2W3mp0rsFawVZ4AAC6sy82ZeZKp5pD2y4c0W82TKzCAqN35BexpjD/\nqbbQK64WOpACmoyHf7etLk8rfAM1ShIb2pgZ6wsODFJs0CUkymgYrgkeG+CU\nQ7vo9Yy80t5cTIX0XdYIAvDAcJdxHLEtQaFJXseUzV79ncGLuUaxK90Z8wov\nNmNk58iZFbtCD14zTOLAjnd73/BekhAosONnKQx8QWozZZxObjMMW7vT6L90\nbqiN3DY2JlYsQB4BgnWKI4shbuXeL1Ox+ykovGJGHRIxpdbEX7hYqO4w/T2m\ns7XS4wOTNjFWTlVR1DbE1ILpxR4zu89WF8slZILR6VzNnSlp1q7/MMWpMANd\nNtm+LQlkW9MQUOrX9xzO4C6WlvH2tAXba18tRPDMx73BUZI/j3YHoaSZK++W\nfpEpnBQLxEMur4zr1MltsuPJjxpvf8wRHPgZNX0L1qcVwcfEOS/fQL5Z4ONM\naCwf+3bhKSVfUbqlOCCiZrYxwX+4shH1hhC5oB6JKKCpJDvgU3w25tOkCbox\n6HKJRzCW5shP62p7LhC2w908PDncpfhZW5LPSVpNEKS+E+kEDYZvAWZ6VugW\nvsN/\r\n=a2GS\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.1-next.1533002862716_1533002872118_0.2654482884497762"},"_hasShrinkwrap":false},"1.6.1-next.1533003082302":{"name":"puppeteer","version":"1.6.1-next.1533003082302","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"1931cb479e02c185a1085e96d678410048340935","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.1/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.1-next.1533003082302","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-EMWH4f4zOQjLfMPNJ9xUnPEJLdwETsoNLRMCHY4LFfjy36ZwoKXKdZp8lpuvmWc+/XU2gWv/lqhDJQsDt+ejfA==","shasum":"24460ff3ad70c54727ce82994e80dead1a1d0580","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.1-next.1533003082302.tgz","fileCount":54,"unpackedSize":598642,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbX8VTCRA9TVsSAnZWagAARTIP/1rOCzQdkVBrqnaZhEsN\n0AMZZqcUiNIPn4LrRMyVw2MyYx0UFnT3EHpwRnbEobg4PbZd5CI6vTogKcHr\npWe30Ek/jDWmSzXUJgWLiIDZHsS29ssSgBVoOyM1m1WeS4v55+U3MovzcSpk\n+egn+wLEj9dKIWHaMaNcQt7tCLYd+hzs1fC6SMWPVUZDBGcLA3zftLx6F2Fp\nW/lChk1EjFZA26twVd6k5D5rp1VRlEPUPcCFLK3iZJszW1c/ougx3SY7vyLD\nj32Nu/cDoqkjBP6qhDCc3u6dMns4wggZ2hIduu5vadVuq1axY8Rz2tZTorVa\nZa+7RB33Urp9zTTCU2E5Nk1yRcnywoUY+Png/JvOqn6GneWB+dhYn12qH8ED\nBf5xb4ql36XGj3c8O6PcJqSfg/KvoH1iZdCalgME+IGxBRdCbuWTKLKc+03T\nURyC2vGFXmqmSCWV/FeSP5GjVMiN6xJxqiiKrswKF3bxT+gKtNiluOzt01hk\nsWTNFZn3jTX0xyz6qsNvNUynBokibOGguAbNOKpSe7huvA48d/tuvdv8adET\nnjDZgHlCwRtCUIfaTkCvTp2Q+xgC2eqrCZnnlQUKIMHnOcdXA/WEXtNSaDOM\nOgebfTLyz8z8Ya0rLdgBIY0ogNWvrXpFD1TFkMkoJtUXNKzEh8I40GOceW8U\ny6Ye\r\n=NzgQ\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.1-next.1533003082302_1533003091502_0.3278210570362605"},"_hasShrinkwrap":false},"1.6.1-next.1533061595073":{"name":"puppeteer","version":"1.6.1-next.1533061595073","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"3335d369d3c5054517db7cdc541aba31184b9d07","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.1/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.1-next.1533061595073","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-PWklXaf+TcQIn4/zj2vUPDAkDCyzrIyNwHt7LnibmiYkRRGaYF5HkiEX0Px3bs+YShFpjaO2IyzgucMO0qnZJA==","shasum":"75d857f4cbfe7c0e8e3d994f6d07f3bcaa2dc48e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.1-next.1533061595073.tgz","fileCount":54,"unpackedSize":598408,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbYKnqCRA9TVsSAnZWagAA5uIP+QFJmknXfq3VAZO2bgKF\nQ8oDgwzWHpylDvY8eFLQjpIWCVDrzKj73yFD7+/NkF8LVYn1DbcYKWKHa+Y1\nafBcMM7DXRbe4PF8WaG4J9uIcJSfpKS2oduSYHGAHIdJ8YoQnqgFvvHXDgAR\nO59cQUSscQNvU/wBtQsfGx7XrpP/RaqpUsWhbpPKiIRhOUgFHakgOwodgyHl\nS9A2dLT//g3E8KjTVCgu4Qn7np4tptlFEkIT3OOiNsGJB9mHp/K6dtKqP7XK\n/1RDKoFikx2LfiiAJ+fvR2dTKUfuLMHOW2ck8lIUZoDjMjmDcUK/ExMHfyCr\nre30jWfiAwYxQXWDM++vD8L0quhS0iWDnKBeOjQX73TqanqafFLheAx7bOry\nNaQgoCm8rFWfcmb1Bkgq5Tz2SAK87J63CIbvcqibEgVL03oR1YDWgAcOAFjD\nmXrdQ0kF6c9op3MQgwaBmpXJdjrX8xjvKg4mqiBc1/SOixuaeY1jiB6XEV3E\nroRvJWgxUU99MhxWf73StEa6sld7O+7XfDaL3EwQyMFl1lTYkgK4FP+slnHE\nR+/43eRbnNn7ZMFa8QqLEdvq/lxCBgEiCTqi4TEU7tDz7SyoY69MR/4DtzAH\n6VCgbYNd+HeJ4b07gbfF94aL+jhkGdU6ILbDCn34IpnkCQZt+uwF1mjtxk3E\nt7i4\r\n=fQEr\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.1-next.1533061595073_1533061610741_0.08952485555568934"},"_hasShrinkwrap":false},"1.6.1-next.1533064908595":{"name":"puppeteer","version":"1.6.1-next.1533064908595","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"25d7eff37441125b168a2abbf7e78988ed46af2d","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.1/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.1-next.1533064908595","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-z0V8Cp31MmDX/k5mXWpLqz/O0lgECwB9QNVsnDwGaGmIPPIar+LGNcCBTe4+60g/BoNrX4RIfqkJp9/RUSN6rQ==","shasum":"23b5cf60d3e3632503fb3deeb4593c09c7efa6db","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.1-next.1533064908595.tgz","fileCount":54,"unpackedSize":598430,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbYLbaCRA9TVsSAnZWagAAgvMP/02/om8mtzp3BWe9Ez5O\neiAxpCOcM3CGrobjWPT2z2SS8kaOFY9ydL6n5IU/ePGV0COAbtzK3fkZSQ9a\nWROsY4GbBYpMR8f0gRD+rnb8fuK4sUBJjR4bxah+DhIishJrcmBxI83ljSQc\n+7RBGB/5uIl0zoqO8IfT1S+DU7WMUG6KkulQtBPI0FRghgpVu6EksJ/rSdeM\n5KHhULyCsYetxK/FM+/ILT1+iqwapXdGPHc54OXqONdAI7eccfOz1Bq1yqe/\n7rnyxNTMwlxzcAMk3W9g1l8b3BrxWyIqrzD+/y2ybqUy8d4rGoDEI9LvJytY\n5+iyi6nUf/xNqm9X7+iYd/SF2Wkmmmgfml25ISfmf7rJW17O0mePqM3NZyVn\nawacmVmsfHLekis7LTufOFUANA6APM0LMaW8Fukxm2JG0ouFLRkkpVO5W9Gy\n4IRNcXf2f6qq/Oqb1qeQgOWK/oRhRgj9b3lD9I7fElk3gj2q4QZ01rjGsKfA\niKG7oqH3RK64KpKHcJ/7gj4JxKsWefx1QHRthiJ+oYjb+oLIQKVQSJwknvAn\n4rGh8nhaFUvIECJIiL0LzHzkhVJSoZ3jPKViHl6KGrheMnqIXJRnu0JJSXJe\nBr7sWpilWmExXMi1BHeOXMEJj50JnZCZDPH6XCALR2GcYNAaho4psR61QgFk\nT5g4\r\n=f1s/\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.1-next.1533064908595_1533064922836_0.8063508489718876"},"_hasShrinkwrap":false},"1.6.1-next.1533068895359":{"name":"puppeteer","version":"1.6.1-next.1533068895359","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"c018ff1555779786c3278a7b3bdb02c4e057a6dd","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.1/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.1-next.1533068895359","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-UazQTzU8WZ+8C7Kyf59QG+rxMEMUeFK8pZDfOhlkYgYbHEYHXj+m7NlN+WlC/yE2SzTr6vnndKKS/JBtQax+ZQ==","shasum":"51a24a83282b55f373d342d3dad7d9513e6e9b68","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.1-next.1533068895359.tgz","fileCount":54,"unpackedSize":599572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbYMZpCRA9TVsSAnZWagAAryEP/12F4ZECvbvf5hVJ2DyJ\n//ctWCfxxHO8oRctdpZYLV852Jk97wTpqbo08jmv5WmMqHNxUo/+XWaZ/xSZ\nZj6VrVYCGLEpGSzaCj4MlqwQLZ5K4t7Bo5t67cunr655kONRTOFXffaMkqls\nzOkLxuP4FlHNzEuUo3Dk5UpXduMztB+Q/21ggFLaMdmHTZkalNMF1c6bxhiO\nijgDIsbvJ0l83rZDscy835sEiCBX7mdWwb1N/AGIWkzfmiIfvoAB2CwZze0h\nhFFJFYihdO01y5XS6YiYjLFOaV7Oegq9ZXyJRfrPzzFm60CdT7TnAxJMqFMD\nUWVQwOfGGHyDodA2xtVwKy9lGHkLm7T4VtaBF7w/l6ufZODOabZw/1yuSGrT\nwW7sPCLDVl+77YvBCr9worH77aKOw7fDzuFSBEj3W12uIqh1a3wXt3mxYTOx\nU4UBzURh8DVpcVEp7Tvi4mZNO2YjfkK3182sw2/Jo18kvCaIXUIdNstkAUt/\nngPauSFff3jKJfmrSa6vPnHGIcSQRAhz7LxsktgmFBk5t8klN4nMO7JRSF+z\nER62rYYkmrnW+rIBQxEaaWTrmnd315kelJ3PFIfv9qGQMtOw+hhylUUGT8V3\nbgdU7KLP9lG4LZb8BGjoWgpR0JnxKoibBpwXt+7V9qAX91XCuBjH1RStYgYY\neQ93\r\n=H+CL\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.1-next.1533068895359_1533068905179_0.287994998007421"},"_hasShrinkwrap":false},"1.6.1-next.1533075061771":{"name":"puppeteer","version":"1.6.1-next.1533075061771","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"fd5d95bd9980534c1f7ed2c481b4f348b3e21dbb","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.1/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.1-next.1533075061771","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-RS8RzWJKo4Dqjeot0vzKXNvNXctqsjJNmDB8Md0o39EkDpQ09eHpbdOcpEWoSH9WJUXbZkMPuZNySrrcJds5tw==","shasum":"f27d3a5da69026b4ce0b461819eb6838fdcdb6b1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.1-next.1533075061771.tgz","fileCount":54,"unpackedSize":599572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbYN5/CRA9TVsSAnZWagAAcBwP/iGZM0R1YhHKue8+kOwh\niq43iPxuj8d7Vg8YHrg7S7N2st2BayVnlsVVjnSbhuzRORSVhRo7qo6ax/gs\nif4B9sjXGfq66L0zsCEACINNjE8137QBtsRNoZ4KuM4ZtUPvuE1CSWQ2CZd/\n0knQSmxmiB7wjWJOsor9ohPNKbctt0Vo6t+26G7PtnJU3QPgpcp7xDFAr5cz\nL6fEI7wx6IgZrDHH1bXDE4WGBXSyfdL9Aes3ngb8BF3bPHceU3P0PEnXWqMg\nsWiSPyePiY05iZGB7nOnfQzupx8Y7cL3jPbDYFIprRNKqTUXgmmMkD29/j6S\nDZaGO0klN5wdWSUfCusMqPhJhJOrNUC8OVRPmJ50ciAy9cO2/38jsatEEZBW\nDj3hG4fWyXoKG3d82bVhzsCy9Cm+PZ2wWYTqAxXaI2BHdOMBPyHuF9n/0gEJ\nivhkpKJm5c5OnLp+/u2ZaQU2e0WYNxunntbxuMr/WcERHJK/31JqT82CGu0c\nQq8r/7TRDPq0nwp2Lc/Nh3NYB5ZXV3y2aCePuXYcH6hJRyPGOldmwAYujG2H\nU2OmbinwkgSKb5D1Q+eQfkUSanQDgNVGdumKSZoRDG7Hd4Ypxn1E62nHvcyc\nKXsl4es0iVB2GI4wdQaN1FB8rbHnl1ZcVnJdn7+9VZDPxcbt4sHDU8EcSnKq\nlrWM\r\n=igMs\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.1-next.1533075061771_1533075071606_0.37641718411156533"},"_hasShrinkwrap":false},"1.6.2":{"name":"puppeteer","version":"1.6.2","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"575458"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"ed52acc183700220de75ebf0397260c1c670e7fd","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-KBgMr/ZdwIwDQWTqcAlGhnQ2Vd6p+o5B89H60XUfdmCpia2KViSZsdRjvrf2wYOxXSrpYx6OuCBzV7ppLuNjNg==","shasum":"e3c31f8184e8fb8b36e4263921bcaaab7a99b3bf","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2.tgz","fileCount":54,"unpackedSize":599110,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbYhsuCRA9TVsSAnZWagAAIOMP/i2epzdMLgcloe4eTI8g\naVotsqzR8d5N+tj2lGKmK2S4Npycc7C7zWH8v/STqkYQvvHPb0pDOUNBAfrc\nOoqTBiENcYM9/0YOES0giYHA9Z76ExKAed/xRglpvJnHdEqW71TBGxt6Eoe3\nGWFeQ6jJnWFJNGh6p6XRAWIdK5EHi009CeVKh+AhHdt11rfHt39O9CkJFhr6\nbQ1ct4wjds8k07AS7Lp4ApEEg7PXwlQn9u3v+vZzdPsKbNAdRU01WzCP2phQ\nQyicYtFPdoUbatGzgaiwcbDfNu7RobBbKig7Rkxpyd0Hd3MytqguYDERTm83\ntpCQC7IcKVRgoK0D4VgCWwUi3wgcmFOvnWtaDFOGwqNvu1jYFV+xFnslJWyK\nmIOkJUKa/qnu9rOFHhPFAhUtNqjs70EIY6fMJkagAZV2WhYozTdKNsEVtXTv\nPoRynMrtW3YgtcnLEoR569n3afE75o4gBuoTpuraJOh//2z9/6Fn9Bq834s4\nEwtEWAVjXv0y0rNQPALXtMaBC+G8oB+XGPrYYrz8tDycKJP6dXXfrdHwqWRE\nk93EAym42CWa0Y4ULWOXyRgSbmcANHSgwVksJxK+sJ1gpTfDodf6FZH/V6I0\nE/7o595u7BPkGnLdikk5zU+HZK/udEb3SS3fki/EtvPsdutZ7VBcUjccaQWR\nBPI/\r\n=O8nd\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2_1533156141562_0.08170777219201275"},"_hasShrinkwrap":false},"1.6.2-next.1533156975351":{"name":"puppeteer","version":"1.6.2-next.1533156975351","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"e36a7ae677554e0feafde52ec115d764b25f4edc","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2-next.1533156975351","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-8wyNuXrZU0QuO4sHBBO/8lw4PB8hYokj8mg1Zi9qSIUgAwHKydx/8Ru8FwODZ+m61UwBfMdO0K5Qv721dvTaiA==","shasum":"b23be34007a23d2441da5cea0333078f4dcf1386","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2-next.1533156975351.tgz","fileCount":54,"unpackedSize":599572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbYh58CRA9TVsSAnZWagAAP64P/AlO/wSfvXcMjLSr6gBa\n9gQFWojDD3sOtNQgSxqHcgvapowtcM4jV6kEj7UTQUpCmzFko1NwxymGMe5D\n+FZMY8Vl0SqGp3RwI/LIcjdbAe1T6QB8IBTooal7T3Taf66+mhb6fI0YXVbi\nB8YKoJhgmstC5ysJD3+xegvGd4foo+RHm6TO7XpEitIqMp+XZpo8Bx2fwYau\n6SpkZRQ5EEU0/rykK7Mv0PUfcQ4iqYIC2vUtSESomlrUOoB+/Vo+B+bD4A8u\nF47xeuUYwzD47y+APlpyOlZQaJvw/GSpHrY9+FA9UKCvmqXbpsarcEcVbdA0\n5v5VI5hN6sAxZp94lBvbaqysBRcxgpzobmhT6TIlVNNzVMjhWaCmLe1qyroK\nTNlVfX4NHNxnVklUIpB2rIt8qDGhynS+x7zSH9EFQntzwfMSERjntPo7WlOJ\nOwWEtlZD0ha93ov0LZpUrxnVDX+d8y6pI26Dw/HdTggolHA9VmtD/uRDgUtu\nLsthn51st1DkmH8k9F+rikqmhMG1nVvbHtS/c+/QU4/u69e9edjaLAjMecQu\n01+yWDW7DkqeIVcYUu6SoIlaBznDxCrQdXMQl+MesKQptQvdh7mBLsx/vrtW\nwRTDKdVW++FurMCMftPwIx/j3yaKO5GvsZOdUKkvHvpNtdy2hgqYb1gxRtCW\nRdAt\r\n=k7XJ\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2-next.1533156975351_1533156987876_0.0521120260472312"},"_hasShrinkwrap":false},"1.6.2-next.1533156985664":{"name":"puppeteer","version":"1.6.2-next.1533156985664","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"95d867aaaccdb54c035544435cd0ae411f7a31de","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2-next.1533156985664","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-KNTuf+hphrLLeWThoAv5fREGQBAa1d2Py+1s6Xdtr3QBUqlJU6ZXmlr9jtqUh3Ryg2WVR7fI++eoF5sRz6PFuQ==","shasum":"bc97dcb500906307ed22f8355e22dd383c2893ac","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2-next.1533156985664.tgz","fileCount":54,"unpackedSize":600056,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbYh6DCRA9TVsSAnZWagAABPgP/02ZTOLRqhgxO3R+sB+v\ni+UTPoMR2yeBzjB4+QbOof1pKDRY3yn6gx/r1FdXUIqdoDD3l47oh6fJqr8f\nc3BUkQ8xAuTdVW5nWLgUhCvmNb2s8W0WyGCSXEfIkG+rMxPszVpXbN4qNdy8\nWFBNMZYMBtDoqzQQhzXV8uY+XtMPeoEKSQ79IBrwK5fPq3B3z3ShDKm9nI2h\nqGdgv4dwa+BoS6dnVTTGEHeMM2JLJAhir8ZdVKjtOGdaTpdt+w84qTyAyFJK\nmP9a8DAFJ4ssq4EoTL2siqopH84KkxTr5lmZ0Qws73iAPMIVruUMJfoMt0+l\nUm7Sg8uhTXpB3uzuKL0iq+510W+Mmg86fNixh+n1QcRAmKEHNDy5Fxy8sC2T\nkL9ukPueX9pi90p7kQyKhYchrdAufTJpTpErqZiWlBn8jXaYkXrnqNVhDhjm\nOe5xl39wFB5O19Q9gTQvh2yqc56v/DAQ1MQ/pVx2egayTfQ4hbx1jYvHls/E\n7OJmV//dYeKeDqSUCqKPdfclGKCE3eleuvB23CDlGdejjUUc9awOLBso2qjY\nCl9CIAJ9kHcJXVgCj8x2g+P42mv5ghrnlM6xLoedAPekmwCvhttDwNKmFtnu\nW6aQJ+wjaCCg8K7ZqPW8U9VUtyrb2RberXYeTtwtjLRKn2wmrezySbc6VRnX\n9diM\r\n=gbbc\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2-next.1533156985664_1533156995033_0.38773512562225765"},"_hasShrinkwrap":false},"1.6.2-next.1533160767482":{"name":"puppeteer","version":"1.6.2-next.1533160767482","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"9c96a9283f7d29ee516595c4ceb8d3c25628517b","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2-next.1533160767482","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-mqg6VxhucO2eOXqo4p7rPNecqQC0erjoj20DuCVO53qPdxjVbM4BXtv28I7dGzqmu2vnapYc/IB9HbdKPqbMLg==","shasum":"f61b8f8aaf2b25f4ebc1a6856775024ab695dca0","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2-next.1533160767482.tgz","fileCount":54,"unpackedSize":600056,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbYi1KCRA9TVsSAnZWagAAsWAP/1b7VfR0aG0rNjKcZqTb\n5+oU9GGkBiz/hW18phSLUBXchfHiyX9/aWWerMt4oHWJnTs/wNlKz6KO45cT\nXKDfscArZda19HAiwE4baTwGdLEVnZXEoa8bgAcyCnTKm+fZwgUD4Qf5Nysh\nN+BBgxoUTrOBwcp2DA/Hc6cFOCbKabEBUgxEPq7ZOQZ67eoJAUIVIwBUWVyH\n0ztRjo551lPZrxpody0MOMOVqxHk4a2huza3fPQdEiKR4JSQNd036LPKn8JC\nsZbJBA/02upDXVewQUlPILzrQ9+nmsplJmzFbPJJj+cTYg91zQkfBcoqjEtc\nJxm6ZmfXcMrs0B9Mm9pR80wYdGj+X02lulgasXsUnH+DJLOd2pcP2fp65qVP\nzlW5ljd0Z258fWl2XGfaGcoFMi3rgJcR0bHCa2vY1uljYCxi67EJifFw7l3T\nEBH+bnfbGtdIl8N0S98wNZ7D502VZufxfuP/adU2ARhk6MVeow+/rptcvHCC\nstbibNUR+cvpqP3E5TeZxlhV1eJpEehej7ImiSVMKf75vGZ/s7a2MXJUsf3u\nfCLRfLYrRkd/RpkVA07uoPjEmMvsMZtFxOqowP5nWO0Gte8wYlbigpeGywh/\nFTC8kaPps1MnvTjmC5m5yL9vIan7udC6ZphfFmnEfKfLwULRsw5V6cjEm+5F\nuKZK\r\n=P/hS\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2-next.1533160767482_1533160777283_0.8905002065060728"},"_hasShrinkwrap":false},"1.6.2-next.1533163982541":{"name":"puppeteer","version":"1.6.2-next.1533163982541","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"0c49bf52453202f6cd5f44dcfe80a0eb7eeeedaa","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2-next.1533163982541","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-ViOHmIqRgIsdvoykE2CABdkVs2GUKZhiTlG8qIQmx204hSp5qUFAVXJo3N1UgGFz6bdnorjAaVclzRxJeFA4zw==","shasum":"170b08aee6704e8b65eaad0f497d7bb4d1f12c8c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2-next.1533163982541.tgz","fileCount":54,"unpackedSize":600056,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbYjnYCRA9TVsSAnZWagAAa5IP/R1QWEfa9A9XQf8p2U7Y\nDMtM1JqSssqgre00dK2IcvQCiYfnffo0FxdX93UvOmO9H+UehxOI9fMHsa47\n2/gGaOJyJe3763LfPoXhxSfXF5zEbmRb8p+XrqqPqFfwQFeuQ0vxEshVRxL8\nZjsX5xFuWJiQwYkzsv6HFERC00j9gEL5aCYkEGwD4GVFXzEzz9ADnugS8zGO\nDfsrRaXrhMfQ3QRMbzvCCXxpdwoPvkhyYkWb4hxSu/X1TRl4zomvhCOKBm3j\ni3hlQBVi8ZgTzLt4LrON7bTQSvmrD87pONO2XJtjgr9yQNuIlyMdnj6p8tdq\n8fcCOYdOGWkiU52tKKqje4+zJAAXEJ6427xDaLkkkWbdCLSKCATKNNC7dHDT\nWaoem7OmZ7jCCHmuAelB/uxHcVARos7XWhdFRASVej3RmeulyPW7QxiywHhs\ndlkQaplpJKQ8fm/vuqQ4jQoCQ1gShkV+jDGS4+Z06GZvWQG3jYpI0zMJysWR\n7u0UlanO1kt+UbuadOkBbVcxHoZEmYHu3gZC3GW5zOaAiuBOaI3v44WtMJ5O\nvQtxlS+xWAgNs8LIDOb8fC22ojTS2IRqqbw3b/d6px3PlrfN16ilzbF1wGbT\n5tlZ5ypUwOX2yIKk+oknTi/byhTvKB+31CRlKOy+FOYUKkwg3de7cdzvZlt1\nY9gq\r\n=cS8e\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2-next.1533163982541_1533163991991_0.8306622674114095"},"_hasShrinkwrap":false},"1.6.2-next.1533165898296":{"name":"puppeteer","version":"1.6.2-next.1533165898296","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"~2.8.1"},"gitHead":"25632133e2683c613c97d9088968c48e3c07a086","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2-next.1533165898296","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-HqmptU+7skfnV799AZI+qtyKL7ro32i8B5RSwEz1lODBRIkYXGyhicnsuVeDS/G8e9JUdlPOAuK+8bE5IMTyzw==","shasum":"d72e8833cac9314436e056ab1958df631f613aeb","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2-next.1533165898296.tgz","fileCount":54,"unpackedSize":598996,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbYkFWCRA9TVsSAnZWagAAXn0P/At76gYVfQs4J0Hw4lYx\nVBzzFtwn1Q2pi6JxJ6BgUp8eVQz9WpQwJKYCEvjOJj7oQD/jFftBYB/v/VxA\nchZE3/F+0hIn/DbMv9Q0GMrylW8grRpGmj7bVMWsJ7tb1tkx329ABGX+dRzV\n9ZLkfRpSbhh0ntx3N5OtAmPJVKZyVBMOFdubcK7tWyA9LUEGmptAhD7T9onv\n1WP/VQJS6UX7GdqJBGxAKJSGfB1b70BLtdy4O03QPp2fhdeeDf+5b+SnEZkC\nCJ0sqLi8GXJE+HNa/bu6F+Ss758HkFZLN9t5+zQXuQyMwLb8J7Zch92nO0Rk\ndIIb6bbYJcDB+g3q1MuNwif4jjCN4b6lw4G/VWkFMvhnPRYxbbZ3UAugAICR\nH5SF9NVSzLmQvOy9DzRjAjExhdmYSxt4jjMWCIDK8KUcJ+f902Uys0DcrNbe\nWwdxL01jvH+TlchVS4YisvlYziQ9p8rSE1h/FUpamhoqf0VzBTjOotqqbjGv\nabQb0rlyraqBr9AKrP9CUJttY1M/vI/ne4KhBGHnxDx6aYi4Zv96Mw6Cw7C1\ni+6VAMWokpjr9bPlNbO0xSin1BiDRjBNenJLfN8JwZCdCJiktHwfgsBtoESF\nhdLJPw5jH4qt6Nb31mqiILdpioJ1YTMay4UK8lVgQ1CLgrvq3K14I7v5UJm8\nN56H\r\n=n4g0\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2-next.1533165898296_1533165910328_0.020231599644896292"},"_hasShrinkwrap":false},"1.6.2-next.1533580499948":{"name":"puppeteer","version":"1.6.2-next.1533580499948","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"2e0007669da4676bd9dd88e09e3a2eff8fcfdb30","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2-next.1533580499948","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-9R4tTMRkxltltdmj+SF3B9+HEksqcTqZaScmYerBysKcbUkuUhG+Lrr7YuVp/+BaMNOrUe/2ivhn202E7IshXw==","shasum":"e2fd1c0941c54063843ffc4e728dedec2571b7fc","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2-next.1533580499948.tgz","fileCount":54,"unpackedSize":600324,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbaJTgCRA9TVsSAnZWagAAgakP/1z6HaFk5T1ZKf6uq2qz\nzxyiE7/AtE48HZb2MLKVqCUHmt2UkJIHGnEu0vGWc3pGsSF81c2qjHctCc8B\nFP9/HiaG20JzERoJ8O+9xVQkpffjW2PHW3HFNnURzZxVMMyLEWSjE8mlS2va\nQq8TEZyWzC74+/3RtKnxONitid164FEP3mVeE8bPKG9QOZq957b7QICwtBeq\nntgGM/QMSkgx693U0eHIR+JCr6NdzRWXoeeH0BoyhYsy8TVh6Sg7zi5Gsd+3\nKf86O2H11SwQTLjNQX8qUYoZvC4oV2DCo5HQ17MVJSV3RLFMh6+IEg9IVd0N\nklwlkA2Ox3MM9x4mRhJJidFC0GC9CpMFEWW07VRGji6g6dFgNX/To/wBNBWH\nKnxjOY/NZHrR/ECMKr3yyiUSJNzPhEbC0gaa30xfrqTJDdrLOp40Lrc1bHU9\nB3KAqZyXkXumMWuOSmnCRcwnE6kzeA709wl2isfJWxYhRV6EwXZoLL1kBJub\n9S1gmjfmJq47Rpc4DLJE22SDqCXqimAd7NJ2v8Ouu+v+ul6TH8KtXxKZPXqP\n+TTrqg5klumKlPxtetU7QVsWSXewcLEZARMV0tqKlSYC9tfEN6uSKD4GFwjK\ndRI9r8zWa4JV74G+goU6RTH9qg/qZlOpy2BE6fPjGJMw+UZIaPWubFlCxcul\nLHRu\r\n=Xths\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2-next.1533580499948_1533580511744_0.010804295746533521"},"_hasShrinkwrap":false},"1.6.2-next.1533673461575":{"name":"puppeteer","version":"1.6.2-next.1533673461575","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"6825088644b26ac1f2dec0230047c0e7314fc4df","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2-next.1533673461575","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-MzxZFUIFz1Oh1C00UUcjOu0f0pi6nNBnfnpeZ5I3Y+72+dxq9ZEp0wqOuRKRvWikN6vBMPBwbnd9ZtlXmseFcA==","shasum":"6f8326a90f70513b9bc7b92453678395974f8cb1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2-next.1533673461575.tgz","fileCount":54,"unpackedSize":599890,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbagACCRA9TVsSAnZWagAAw2IP/1pF4HhESn+m7EwPb350\nuAZzY4X3mtcj1FwG4Td+YD0cDhCKBAMtYz8CUj4WN2EplU1QaZHqAiPc+dOP\nnEFP5eoerI8ktwHcxZDGeoSyGJMQ4srSWP+fYvc15yuvOzKZGiuGqQU2JrbH\nZhzhI1D1uLyfOI2ZOem8UzXai133eRj3Ckc3ikjgTgM/pkBC2Px6zTIQgYqT\nK3xfpIHOIH4fFGSVFwEEqIZ3TPScLjgJvwti7sCDMZbhWpK+k4Bo46VIs7km\ncQOo4dIhXeAqMdMkK7Y336XtvU3qeTo/CJ5qaq8TWhwVVg/8mPIyxnPwqhTo\n5Ek83eM69XmoOfhk5VyRD9+kHqftCHji9XUe+E59eiqKesxcsWJhG9fuMY83\nd6gaBXFBv9ftpJ1k2cmXXvcxLEMjx+3xkQMat9N3CXJKZE2Ocr8D6Xelt9ab\n2KrOb3r18T+z/zmVgvnr1FmbqBca8QzBteFsZUIQCv+Y5l+iyznKe6BNPrGQ\n3afRKHkMt8TmWUgf5JxENmcEq7TJ1Ep59evs3FURJvmGBKVoqzFchMDk50ar\nGAYMbGOSf/7Fiuzot4h2IJYGhba+VdgDsORIXwXw0GW2jdo+pyk5P8Ai/vBu\nZ1S4JqnkdeLz9bFkL54PXVaMnVVSO1IYpCHk2o7ZqGCW13WbaTg9JsneCz8K\n24Px\r\n=Bwl+\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2-next.1533673461575_1533673474070_0.7884427990846634"},"_hasShrinkwrap":false},"1.6.2-next.1533673548000":{"name":"puppeteer","version":"1.6.2-next.1533673548000","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"735e17e223cab47551f03a78c87f6b630a91cf6d","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2-next.1533673548000","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-CjmGUicxu/BbGY2EDCLgLYf3tqXRLJd1qrdbdTYEVLMbl0L2ElHBxsrqky0jfpOAik7CdowHYxCPLJun2p1B7Q==","shasum":"ffc69a2ffb597c4618b75ef2cf4fec70c1341197","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2-next.1533673548000.tgz","fileCount":54,"unpackedSize":599890,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbagBXCRA9TVsSAnZWagAA+xIP/0I9OYTxO2s9mH+GJSh6\n4XUh69YWl4Q10XFadn2AQDWoMrHJgM6YT7jbVLG+MvNQvEekyBTQqQdQcf/O\n6rWSZvB4vosHS/HKCgz9qkUPvBWZSbsgAuKWuf/e5qxNlIdiZTho6fQhSSJo\n6Loe0+PhIxgEg1XlGAUt2BtdU6u0yJ2TiT4awnI8Yw2MTdXfs6yOWo1WqWTk\nKlnDLKxdm1cvvXs+YV0uhgUXK7q5h6W49k26TZ6UiwrAgiS5G1nuRGnjOpmf\nQAzdWeSL8V8Uq7K0GyMJMMioPu4H1STFUVlz24pdx3ARXsvp9SaMKMBETWYM\nArBT14mgVY1714yesJp2jWIvZG+YhH160vo5osyTWxIjG87c2pxhjevtH4U/\nydTqnFqvhwEPllSN4HnWnPzM92QFLu89ix4I1e1qu7i8uwfWziZSb/AlBG8n\n7LJRdDvaKHE85xFU8RtpvXwHqV5vIcp81ItWgsAGE+ol7WFyW461Lu2dVSkz\nG2ov1W6wEg8yHcaUVxyizt5dWTgtEL0033axfPVpcict3e26zRwdHjIOHo8B\n8FcFtv0fcYtPGPqlv99tT0+ltQrPXmFtImU6lhfUK7EW3fPjX6uSi1fHOPz0\nn1BXC+QK9p4fi71hNPy9lVeCf87nv35tQE8NOvr4fg0N30TZBIk8AYslv7ld\n/MKw\r\n=Q75G\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2-next.1533673548000_1533673559172_0.7261309387819015"},"_hasShrinkwrap":false},"1.6.2-next.1533677196394":{"name":"puppeteer","version":"1.6.2-next.1533677196394","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"d8224014496518e8a38b3ef78eb21f7fc2463940","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2-next.1533677196394","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-cd4IohOPtIyypaqvRPC3chEBW6Y+oH0SNjq+MR26e/l9ZrwE1yE77spixbFAaKmKqiy6tS4FLjSb9INlN6O82w==","shasum":"162a17ad57dfdaed1dd7adc26276f3b69c64bfb6","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2-next.1533677196394.tgz","fileCount":54,"unpackedSize":599890,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbag6WCRA9TVsSAnZWagAAQXkQAI+2z0WA6muaVdkXJLnT\nRzKSNQxo5UBfzO101wyZw4UiGAFbzAyZN8fI2EKzac6Qg0gwyA/4xQumRqHc\naBPKyX2WMtNtoqxw6i6oIyww9i6CJq48gyaqdpvSP+svTui7lqryH0wlm942\nany8ltIpMU5OiBiHCM7AKrnrPZfxZVG2bdxk/erxb/YGuX8Yctt6HqWSZmBr\n/u7NR6/xIXru6PPkwW3CCq56ApxwdHBPyXvNYOVtWOL/ARnzcwYRlSuXSYlA\niFQjzvAKaqIm7VF9ESN8uHezGfZT8l1VLixLYdT3xEJZx9u62goRhdql9tqB\nLoN5YVxIS+Ugp45TClPosQmMtgoGT9/FlZj22jGsKtmC83MwKNtmR9xZP+ap\nESWE8UicFmic0lo9p7muHOWpc/vqti0ZgGxWGgR2qbUdAU06xcptd1v0M/hq\nSob2/8v9HDWN4RmcmY0UlldcvH5XvLbVu/JrCIph3hBihuHzpIn07gJDUqEH\nWxLz5//Lk2+NZA5fNcnwSSAAuL1wjvhvg+gLotLlj3zR7EeF27TZAnp2UeQ5\nSDFmpQ46VXXgV1tOn2XXvoiCi6KHhxWOhwsMXaz1WpqeLz0l7ijqhGR/jF31\nf1I8nC7ArpVjdPKRRHzmM2xJX+caPwypnSkNvBKhp0rKCTe2KxBBOCF/Bfuz\nTxAu\r\n=NrkK\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2-next.1533677196394_1533677206475_0.4806603767190911"},"_hasShrinkwrap":false},"1.6.2-next.1533677198046":{"name":"puppeteer","version":"1.6.2-next.1533677198046","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"608f5b79fe83d206ee89aebd7a3e82e9b83b52d3","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2-next.1533677198046","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-5YGuQy9Ys67aVfipcWZooHp4rRQoesIgrEzMfKaRq/ivOwhdXrqA+csJRjO+GsxwB+/peOEqZ0X3TAlKYVvdeQ==","shasum":"687145ac296199280df2c565c34cdb704c74106a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2-next.1533677198046.tgz","fileCount":54,"unpackedSize":599890,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbag6pCRA9TVsSAnZWagAABYcP/RVlQM1cfcOOprQNXdzv\n7l/SVW72oREWKNVLv1p0FSgp7UJcXAsu1XkX/QxyGgeFp4ZthEjNKZkfuGek\ngjufszD1lmLeGcMXjHnscj4T327ShHUX2fY+2JuKWsj1cd6NK4g5591x8HmT\nMFuEtosEekLfXufjVjVqeqPcsf71aseVK00Z4rSQBJtZdS5N9K8hGl3ST/Wt\nmuR6RolrJQ5T4cTKOWF0GqYjPUI4Zgcgizg6AMiL8GEaUzCpAUh5aqLR9eOn\nc6ZUNuSaOgv7cA3gvg6ls6V4mNYBzzR3uW1XA9zJknmlgDMsXNJAglGwmDZC\n94tUEKcQJo07Xk1gKkHPqi1ArV9DbLGQE+SlbN4+SOSg8rrgrFiKPuB1nWqY\nuylKu81B5tO1VuQN8HzTUkF6soux0JwW6YzyPseXcxIFeFC6k0ZD0eBtTORd\nBqqTdAJ/gzVSGAF9fLMlxe08geQbenkBKRYSbYQLM706ckQW5sbDkWLXt1hE\nANNLu/0uudbIbD/36WYCmVNEUTyPZdBCTRtTKgNBGMDnE1mrKSLwRPAdCPeH\ntfK0Vl1VLOm6N/mvEDn73RHjRIFvTF2jYFehfuPqyh1t4PmM7Fob5U+kp/mc\nxpC2YgTAlBAhmftxTmbtAPddmsDNXPLD2xx4+zEbrvFblcTTmkqBxPpoT6eJ\nb70J\r\n=evkD\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2-next.1533677198046_1533677224886_0.3963635036409825"},"_hasShrinkwrap":false},"1.6.2-next.1533766644133":{"name":"puppeteer","version":"1.6.2-next.1533766644133","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"81d42c4688618f19b74513230e7e30c69599f4ed","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### <!-- gen:last-released-api -->[API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md)<!-- gen:stop --> | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2-next.1533766644133","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-Ysy/9KAIYtzfzJfeTZFl8LzilN32vMCOwbOPBPHL+ph4YLV7s22qPspVBUPrKv6tclDoxQ39W4OZj5roM2ThPw==","shasum":"d317971738979ffc5d1e4a0ff4a9942886cc60ec","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2-next.1533766644133.tgz","fileCount":54,"unpackedSize":600355,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJba2v+CRA9TVsSAnZWagAAMbMP/Ayp4w0iSMa4Jl/1fMoD\nxIWl2Lk88Mk4WEV4/yZKcLhK/IAzRdFCMhWDCf9JtKu/YWzo+JrHyXLkSM3l\nbNymRYh7kcq+tYk4rU07rFMWccmsLo2ete5kZBhV+JUC2CyWpBXE18kjOM+b\ncPFUKQ5soIHMkXY/L+tf20Nv9Hv9VUsFK3CnfpOrcVFKnHtHWjMX+LxsvcgM\nZSuCQf1qi7J/YQAHtK0YqdLslL3b1sW/ajDRiIk4piD1q/nrh8+7bzWqG+AV\nZNvtj+EsAurwwI7iWvvxlr8RcfJrXLNKHHJpHf9Biipw6hR5Btn7UrjSo+cc\nF4Ucf9AYYnnWUJC9KBMhc+6SR5AfPujJAVKRbSu7nEiOAOG2TvBDOktw4DZj\nz5CSgBI9IIwyE2NBJwMsGDD6utFjavIGZ1M88sP8IbdXK/9O3Y/XxQPlBrVi\nFiG5adgaRe+IFZlT34zx30H7JMiKCbU69hd3F/mE882LLI3cO5SSe89oKhyl\n560jlQRCrjDYpJMkseNtWzMbng1iMcRzDC/YzP2H8TKezWDvS9Dl45HZMkgg\ntQ/+GElwXgzr4nUTZ7RMXVp8Qv1Fr0+kjWVZfHXq2V/cV8nZAmqNr1TJvYGi\niesHRBQohwAP5pFlJJoP6INohtEPqrRq03qtbxCc+Q3ZswLpIiT015s8H34T\n0c1a\r\n=Toy5\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2-next.1533766644133_1533766654620_0.18253945402260086"},"_hasShrinkwrap":false},"1.6.2-next.1533777762233":{"name":"puppeteer","version":"1.6.2-next.1533777762233","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"1be7545b7098ef6c286c3a4992d7bd372995db6d","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2-next.1533777762233","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-9sLHGK2fPwz9mo05wTGGGkgK5F6dRNoTf6VRqNKlIyvn3leX2aUxsTIyZccQX/yaeGYKQFEcKio/poEHG1dRng==","shasum":"b899067564ec28a2893910c6f612c9ae0551207f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2-next.1533777762233.tgz","fileCount":54,"unpackedSize":600308,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJba5dsCRA9TVsSAnZWagAA8HYP/RWQzDcQ88Zk4us21XLs\nQgNZtwgzJztfbbWaIWC8gUdUnk/+BJMtE8Hw8D7c6VzupI9tmjLyxzAMypWE\n+i130fkMuu9Du/5yyC/hmki9RrSKMkZgKAMlH+um1cUXw8GTMsqIgOEfQ1+n\nO/KEjK6iUjHtshW2PkWdXzpG8lF657fExRWfBAYrt2ppcNhUXA8Zpz5KBv8W\n9TXtQykbSEovTTLL8FiPVdYVU5UQc4kEv1uS2GXcLdOCWrP4Y2kAjYO5h3iY\n+Sfc1lpdHF1flzQ0uAFXWDJwpozpX4NhscmG57u14yywm4I4aQGn7M/L0PnB\nl/v61UhhXhw0kf7Ah5l8MBN2Vf+U+kpAbfu6nGpKl6Kde8pdqCr7G49t8a4F\nhWD6IQKfn7GUGW9StKyWlAB5to+kN/xuT5z5Kf0gx8NBt+bVLXNkoH8tGrbW\nUiTLG0MPghUrtJpKDTBELGgtfDpRocxUGrIrvShqO02SF+lM1jRO7Gl8Hg1K\neCxsnD2zDiKgoR2jpBkXoz0QzMAjuuW2Xjdp9JMOSicLn0UOOwbHBCktt1nR\nVQP6ZqPD6VR6/j9YE2/Sdlh4MuroWLnpU8EWmm/zfSuGW7z9/GgFTGQdOB7r\nQVYNBCf5EH5q9LfYYxSSi2vCHnlUrC0x69g4RHRvyDbbLi0Hh03q//x06bFQ\nRIYD\r\n=I1iL\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2-next.1533777762233_1533777771511_0.5727684819684129"},"_hasShrinkwrap":false},"1.6.2-next.1533801194001":{"name":"puppeteer","version":"1.6.2-next.1533801194001","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"40466cb3a45312986ed126d932cec896c9f13dbe","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2-next.1533801194001","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-i+15M7vL9yyjovvZkRbEADcFCpBfUQUhb73tmHoe2RSQ9S2JHoLQtMc9/tr8nZA5ktc8GC3urWqoUNbXR7dHzQ==","shasum":"c3b48f5988a2a20275344025fd2255d6c61e36cd","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2-next.1533801194001.tgz","fileCount":54,"unpackedSize":600788,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJba/L0CRA9TVsSAnZWagAA0IMP/2XW8B9Ojdqzj/zhYMzV\n9TVWn+WScdW0/UGsrj3hEGOL2KdbhXVZgtqS3Xp8I3rsvBkKvadKAI4XovVd\n6emZiwgAiu+72Ndu61CNQ8a1Gvz4h1GTpBokidbkoEzUoXEVfrFAcanKBSb9\nSxELOlNgvlCBFoIpMxpfMQjuHYqRzYoGWgb6mkLsANcM+xCUmrd1m1fkji9C\nthp2G1dfMgyV1/18ViokBdtambRwWvyavqbH+EQHTO4iMtfCn+UeCMxpr4K+\naJ7V/9zDw6mZ9rWuu3GyloYJQoqJCxh9mDb2U0eblL+SghPPCZLVLv1kV653\nVAfiQURYSZUqEfzCvdNBQ0IwW92pGz8q5CklMUADr9bSAgPcE3Ncx9/yGE3X\n3rT1bkwnUrOTrnKeSdg7W7dh4vtXcHiGggZmRIUS5cK69uwGnyPqZz1aeb/a\nsn6iAh9bkw61LK1DhloI/+Nt8pR34Rg7xVHZR6OfI2nOmUpjvl38P6L8RCPW\naCz1b2/OiYpZQGtwYqO7as8gLbVfsjF0dSUK0IlppdwYCUAIrGO/kLgS8O41\nW9zmrUL8/8PKXlukJlcXJQD681lJPg9XpY7WSJMmkE0NVxHnRo5aalSzExd+\n6deAI3DxoD2SmJtp4KDg8MLrR8hc9siBnrFodKAWTGSg1Qb4hPGamO9ZEn6A\nLiX5\r\n=QqIM\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2-next.1533801194001_1533801203996_0.2875790520407544"},"_hasShrinkwrap":false},"1.6.2-next.1533838658133":{"name":"puppeteer","version":"1.6.2-next.1533838658133","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"8c713ef1bd0ca9f83e1b1b8560190245c80b688e","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2-next.1533838658133","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-Hr4AR/fPfyE0wtzKqRu7SE1NKKQyJLbPdMYTRsdJElPmdCSDI3TzULxYdk8fX4XrrJo+mW4gbcNRU8GPFlEMNA==","shasum":"db7d5127e1668177cd5a8c8d58ce13bbb00177d7","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2-next.1533838658133.tgz","fileCount":54,"unpackedSize":600934,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbbIVOCRA9TVsSAnZWagAADM0P/1UmKzNIeD6/KEX24GtG\nDae52nV3Ow4iQWh9AQ/JT6Jswq0smU3jf3km1zFOCTNIXsoxtUgSzKjYAFJ6\n71YsAs67FQ8v/mqq3OqQVZ/USkWP3JfrNc9lWqHY/kubLq3SBwGP6YNIy1iS\nrL8XBTTzkrcA9eq2EcAqDzFPJ13FXRv7cQ7AIPoMFrWPP6V+ZPbbR7ghTsmd\nkO7hhE6q2wdoRi0C3p6dEhSaGlayelvH7vWp1opyBG8drOpfY/wRsLU2rn6A\nwlsrPHVGV6XGeTIR3RF48owRPIPUqo38RWOx3FB3mW2ZNWsXmqZfTSwCqrfv\nkKfa5UjyEaZ7URM2V76XUNOCy4sU+mVRsAPfGvcfnQ+i9Lye3zm2UTUqEx56\npVSJxDwNVZ4CoffT84eGXASMXp1L/1FNPkPTHVF59WCwiR55bhejUx4oexop\nHvk08w7MyomzW1WSiomdmaeKQrOuy5p9GAXSRmhtHYFuZOaTq6x/3qd9Q7Bt\n/5qf3Rdp7kf206TlLvfuoIxvvN8i6UBz8r+/Fo73VRuBCmbaGZUpcDOzzeUu\nLzdiA0npOJPR6RJlrl7ez1YxGtELDwPLACwC0f312weQo4Y+MPkBdQVbqz2V\n4MyvbypcWKA+3Fre7RtK3rEGfHLrZIZjT/WmcfgpWeQlRWqDZ+XwLhVbto99\n+ihJ\r\n=DZn4\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2-next.1533838658133_1533838669311_0.0857268608804449"},"_hasShrinkwrap":false},"1.6.2-next.1533851342918":{"name":"puppeteer","version":"1.6.2-next.1533851342918","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"b84404c94ee59d47308ccf1c220f1cdb091436ec","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2-next.1533851342918","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-483euraFir1W67MrmqjEoLROfGApe+fr2bf7nJ7QrZbPAusR8nvi6dQSvWBGv6cMigT6m3MvBdBAl4EdH+g0pA==","shasum":"731b326ecf58e37dc6cbd4dbb820ed52fa096d69","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2-next.1533851342918.tgz","fileCount":54,"unpackedSize":600934,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbbLbcCRA9TVsSAnZWagAAycsP/0XITpH23H80df0l6sjh\nLsGUGXln7Y58Jff1QvAVzMSHWxAwkVGSajCCV6JKP+ze0q63Ei49n9j6z4OR\n+Dycxj8rsTCxjuTRj4fg/9+/2jHrSMRcrkJ6jqI+V9qLOZwB3g2fcgrvgV1A\nbi+moOnr0GyVLuRWnDU8FCeycHi3nXdAeFD9unSCw70HrkXDA/7LYxjMs8jW\nG3+RIfOusJIgLvSL2Dq5cf8CuO7qD6EpY9SQnzWXVsMgArM6YuN0d2nlZI9D\nO5F0ncWfxyYINfvXfIPsLZ1tws7fuIvvl+BZ9MHALuJOy08vho2FohLoWYyY\nf4Z45sdn9Q545x7Qv1vg6YRu2YF2REdtNg1bz5DbrP25DaJp7MNNt5wxOtxc\n3YWu2GDrh1BylJCO0u/hB8YBbzauQYm/BDtznIoYKf+lh2Zz3vgRtvcEDxcm\n+PkfU4c5ps97mbWounFCXQBn/Kj1QXRab5Rh+erV60A3sfun9CNW+3tAZGMf\nquHRMqNc1Una/e7jxV+UrLau4zbFBsTLrA75oRUo+iVrxyFDn2yvasVe9mf+\nKxVA1m0zwAiEmRR43fY5Fk5UQIdP7GnETuFDXuAjQPgtISefkXO5PrukV3mL\natIANYmQQQMljLAFbydCxJNF206TJ9N5a9vBJ9ANHt23/1y0PZz9PUNbMRVc\nXzgW\r\n=QEV7\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2-next.1533851342918_1533851355537_0.11741647844286307"},"_hasShrinkwrap":false},"1.6.2-next.1533852010323":{"name":"puppeteer","version":"1.6.2-next.1533852010323","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"231a2be9710f4f918b3dd7f388bf5976d80d826f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2-next.1533852010323","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-Fmup8aG0pvYi/ORVJQPZBJZt5WQhTpJPfRIR6s/HO+XqdWAM4beuTGSWFooWegiCVWUNxqdpBVUxh1qIRafTBg==","shasum":"d2577908255492a06740b915272c6f64c1bcf053","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2-next.1533852010323.tgz","fileCount":54,"unpackedSize":604062,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbbLl0CRA9TVsSAnZWagAAHLEP/1Zko8sjNGAOQ3BTIifE\nB+Sdl/AWkFJ7qdr2e3WIBSO09+A9INyGyjJGOrbJXa/Q7q8BLxxHDgM5BY+H\n4In4+6VHZi6j1h+F7XEgcfYSD7fA+ZECWSLM3Cw/Jr+lFYM8X7KJgwP3tuDv\nfDseQKJM6DekS11ScKXUnHLBoa6g381MnXO9W6AHI+DHHKryqoh2RQriQOne\n/eda5h04Kos0L8flKghOCdcG4iny7Li3V4/3DuaECfl47Npntwq6sxv42a/K\n6/dMTFGv9lslsMzY9uVNlqpCzcrMzg9Vefpr+tdek6wISLEDVHTE4JUV2svD\nPO4Tm0AP7jqAnOjroFJOdaduJli23qohkp6oDk6rauWpeZuBlQO6A8KsiXdF\nADIisECJmYr6bxOhLcroiU+/lSq7ye/uQCmiCXRDWDN+Kc1RC4BL0E0Qmfqb\nxreQpSih5v+fzh8Mc+h0q/0OEnF7RPOBGtL15lHjUgO0T0WB6XpMEyhFIl4n\nrIdgdCe1y8cL2Bgf2+itoNdT9j/1OaXOdJYHy1z/LPyuJ2qrOjrolT6jvYO8\nLBF+EeIAA6hAJwofP703lKLNNIkvgQU0z+KoEGgZdL614W7+ZjnyQXTvAoXh\nthOEAyIM2hTqozVvjPfbhed0IVlktH52oIYEvZ6Ug6F7aR5IGmnC8+UpeQxT\nnns2\r\n=ewj4\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2-next.1533852010323_1533852019557_0.5898441485410342"},"_hasShrinkwrap":false},"1.6.2-next.1533858839474":{"name":"puppeteer","version":"1.6.2-next.1533858839474","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"204c7ec8c45087adec5e970392efbcfe0c545c94","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2-next.1533858839474","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-y9WEUOdnbSRESfFms0X0phKq8lgtPzFTYqYF7EAmT9aN7Ow8MPb1aFUr+ZRpsyZLpGrMIhgifyyIYmbHbRIS/A==","shasum":"00358f2ffca231e9bca0d2adeb315e5c00f2f154","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2-next.1533858839474.tgz","fileCount":57,"unpackedSize":607168,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbbNQjCRA9TVsSAnZWagAA3KIP/1PYkmex3IQJcc6lZY+4\nEXdoseRQ2T8hX5bKmu7Eu0DBG+5COA8A8oK8hUWfEld5dO+GOIDBwJJw9t7R\neJnGPjhRp4cJxAnX0Stsuk0sJuEiYQVY0hI9lQfR0wlirqvgQ/sJoDUmZCEA\nh5YhJ2ful8BBlxjiWryNWZrPYXWT6CoVcWqDovYHdm5JuwMYeC65FQUDXrFJ\nkOPab1cVFUpGkVMSnvTD7rnkvOaBcDDL/FZnf7CgdJeuV8/2shalk1hD91cE\nBDgkBpEH6OfBOY4amU0YSUADB+Fvn1vmoGy/W3zFycCJFuEzPLUn1Fn0wsBc\n6K/zpJYLpegvj+nGoqu4RDqLLWHS6zAxVGNGcN9SbMMGme5ZU5fPJeEuKyog\n+HxhkHjGaQ1/ayrnBZnCSEFIidYS8nDKPlx8A+zTnG/+KBWf9k0u+QK57Du/\nmAUVgwMo+PFYVjDd6glg0tLzLaDSgfkkfcNu8HCE2hwCdxhe1Ugf9dQSHj0U\nMUt88wL98hGOB1UPLjL6MPkFgaJZ09wbSaM1piBruAp1HeUFkeFTQiqeYdAN\nYEP55Ux7w0MO3XAwsVaWPoBBc9cmjwgKRLS3SbaZCsK/JVHiUK2g3QKagVlV\nNsW9/Pptkv2OdZjWAKZGQ6ld3t/7eV6fW4OhUSuuUcyJWl9oijNi/QnLKlhk\nVg7I\r\n=dHb9\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2-next.1533858839474_1533858850711_0.1156607557121252"},"_hasShrinkwrap":false},"1.6.2-next.1533862299087":{"name":"puppeteer","version":"1.6.2-next.1533862299087","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"28ccf5d795e0b3d2f3f5504b6543f681a5f9c7b9","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2-next.1533862299087","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-n/mPz4VKuzxR1ZF06KacReqDTTz04VUXW594/Y2OwQrSweYNhIdPfl5m9wW53PcOctWKU+Bv68XMzdR+7zvwxA==","shasum":"3b9af2beb63122598dd4733623c1233e3ac3bc0d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2-next.1533862299087.tgz","fileCount":57,"unpackedSize":607168,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbbOGkCRA9TVsSAnZWagAAa+kP/1m5CVxsktxLGHFb1L73\nHxoGMhaC83RCc2+L7LbXG3XZhz9gCYEkqeV8of+2rIzLAY/X8qPSecRNN93s\nl4wckFPt7xz9ZTrp9b14oyZUNAyg6ZLQLP2oYDin/VdKyOf44aZ5JhwDmXET\n5+fLgIoI6EOIozeI2TyE26tSn4b0Qe4ehRXcjybPTkwJ3Z2BJUF/6jLiFBQU\n8HtitFncKPADBTA0HwHLeJ+fg1qyVdtTskpEEUJFnPnhOIX+zWcjkQ63QHBp\nAEYUfs1oOQcYxemn1Vgs9y0JDuIdQELRqpjcu4FRJKuNd0yHyxUJxDcSwrmD\nv0/UFgJWHzWRlaUmSvY9tCAFyhBE/gq+JjtLsNQPtp1ICHNjRudGS/bVeWOZ\nNOeK2wrfSZ/GQyxq2+AskH7wVtZxWTI9GsXgUv/7IFN0YUmjwvpuxuDNvpXd\nL0IAPaWTkR24ygo7NiEwiTj61E41gYzM3TduSQHLAK1BdBvR36n8CsMAEIDc\n06PkdbprtkFC0ksV4bJQ5uvs7BnK0aKarjIOV/arkVN7rukWL86xbu+rEtTd\nIC54/5yLVJeUWEp3dbAkZYkdMaVcgJZi+0mrZBIwfF4PZVab3ZO7x5ZfuPHJ\nDYA21IF+GKiKkkrSfASVUPvYJb7h2ZDSv3FPc2BdUd7uQKKFRh7Sghv4eRSh\nO/HQ\r\n=7X4X\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2-next.1533862299087_1533862308025_0.13503067971473004"},"_hasShrinkwrap":false},"1.6.2-next.1533863808662":{"name":"puppeteer","version":"1.6.2-next.1533863808662","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"be7626fa5e8d12aae38e639b8c5b3e525c5384c4","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.6.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.6.2-next.1533863808662","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-3SYcz2xrSznSc2Fu3zCR3QZ0wDyWoGTj7/b5BmWaCz+MTRDRH1DtPmEdG96PqFUFKL5LoWsdsSjwH5PRceHPDQ==","shasum":"f04e81fc1f1ae3209314af5aea3f5b5421843fbf","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.6.2-next.1533863808662.tgz","fileCount":57,"unpackedSize":604896,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbbOeMCRA9TVsSAnZWagAAsKoP/0lEBz5LJKn85VZo7j2W\nBckj833A2WlHZRyzIpvOFgKdkAsnj8s6wBkH0+C0Vr3vOaOEARRQNzqvg0Mq\nV4P5H1bgX+7esaTrDYc4fKQjK3w+QXjIr28dn0k0NY6Jv+i9YHydAzJvd9oM\nVlcbzIKIQ5ya53iKZY5mjrU/uYRbHAPchHgGkMklFXV9uKVzX1IEgIVw5+QJ\nv0GxWgoGW6DSoB+dSvwFqZFCWRo/4NHze820QME57CiaMWyGCHN9cNt98k66\nKRm6k/2+Z/25rij8p0MQIk4S8H4Ehsvng889IF3/9mSBLYG96O+bjScQ6AQk\nsWS/TRiFf5WnKGepBGCVD87xXHtLFotJQH582vx27twEi9/ldSFpOAi35dAr\ncMoIG1FOCLdXKmfVsdu+y+xLLBzYJOGUtVtlJSO0ALbwhvZOyqRNDetXUo1S\nIQ5gRseBnGuopZyZbuK6/2UQY6TSZW01HFIGJK53VaCTEJWFaDP+c6woeHtF\nS04bEmaFHVjsR4rkCdzCuJKwauzzKUFs4lTosQStc2ngzXvIimQBKzdB/oL1\ndi9HYlIJSaIUKkfz1tXX9ltWvgtxbfDPg0cFX2rQiDvIItiJCpMdmxP2ykpn\nkdN6KEZBUe1XBXjJNrnCy8qMyAbELRwtvFXJeZAgm6VCsddKWIb71o1YUXcS\nOr+X\r\n=NZqj\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.6.2-next.1533863808662_1533863818822_0.9306867117854936"},"_hasShrinkwrap":false},"1.7.0-next.1533866199198":{"name":"puppeteer","version":"1.7.0-next.1533866199198","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"66caee4c609eb5115538c76372eb9bce996e08f1","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1533866199198","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-Ho2jAvJnL6MJX2E2ZesJU0FG7HUlCpQDxKkakO4+z6dNLjAgiEqejUCmYSMtA7NURgG6Kp0+2/ThznWRBkRG5w==","shasum":"6fc6cfc186eb052919105041a773c679799c717a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1533866199198.tgz","fileCount":57,"unpackedSize":604896,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbbPDiCRA9TVsSAnZWagAAPBsP/j3GREexrDh5h4Acenob\n9NqowKtxCrkcTuXfzfXpIfT2etw5WdSU0AfcQrEk5/Ez+7hi3o8c8oMx5vbl\nv8XdbvdtMANiB57PNCSrER/cXj+ZdHSYpafc8HXae73mllFaIsIzuVYCh5bm\n5fxHxowdrYp2tRUbsdBPNEal4mZhxy0u0VApUFVwx1+2FhdEdmOdtQuH0Qol\nXbtWfmTf0lcc0Mh8UlQommLUJ+zYB3EQKeGdaT+5y8nAAsLhef8mbMg35BNs\nGOUr4AWgheSuIGyrXOgmCiIlzFNqSZ7JfTnS/IzxozX/16DgNl0t0BDoi0Cz\nWER+CXOORN9a3EZuU1SgHweAkPbKYeqCOYqBQc4d7VqtBLHH8Ol30zR03ssl\npMYSO6EtVg1rTZuY4Qbn0CHk6lVo1XV3P9ZjtbWXA4V3ilbtuggq8XbiNvfW\niVGuWgVCRPF1FfIUNAuFHL6XfWQyBv1c4F+543RpyiHkScWfEtP8s5UFanK6\nifsSPSbOuokklTT/FW0eaGUN+xtvkjPMkcN+HC9mOYZokSdb0qZWG0EQeg6k\nMrFkHrzgVKCXBnMAObr6kU2rcNcdRCaZpAbftm5RhTfn1QfQqJs1PuJ6IdjP\nWPpnPev6zK3N8BKgOTkWaAVqLDHRXJLonbDkb3zrSIZorgp1czVaKN1N1o7E\n21MB\r\n=U3i/\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1533866199198_1533866209658_0.06049388003139766"},"_hasShrinkwrap":false},"1.7.0":{"name":"puppeteer","version":"1.7.0","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"66caee4c609eb5115538c76372eb9bce996e08f1","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0","_npmVersion":"5.6.0","_nodeVersion":"10.2.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-f+1DxKHPqce6CXUBz2eVO2WcATeVeQSOPG9GYaGObEZDCiCEUwG+gogjMsrvn7he2wHTqNVb5p6RUrwmr8XFBA==","shasum":"edcba2300a50847202c0f19fd15e7a96171ff3bd","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0.tgz","fileCount":57,"unpackedSize":604877,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbbPEBCRA9TVsSAnZWagAAlHsQAIruQZgisUuzpidVa+Qv\nGc3pIB+IH0PTd6786dZ0NWKRgMs2LYn4dOnpix7+2H00E96xHfUSaCQ5i2AI\n8HxQT1cV4YYmXqdKxMjNFUMpQAJBxOyRMT5hWHROc3g8RWik1827GKtZHyPy\nlpGCiYuj4qyOMX6792+GS+zjXQZEaEUxuMXDT/0H32xekdMqHNxgRqpcO6bA\ngmUz+ndq0F1P028DUIUvobxle1jBqylWCcOuACq/5WGw7aLsednWDMcJHtp1\n0WPgAzHLSzocltutziPyXTvkfb1iyXrb/aH61qv78Pw0nUnFfuzEuVcskQsu\nhtgKhZG8bJLSgcO7w6RgZN/+C5lqKnzyh+Cthl0NXKd3apBwqVEg1kpR1Jam\nYte4Nvp+i1uAgGUWh4bRyC31lXg+GFidgtHBG30lGnSmPoo9GjDV7p0s0wRM\n1XIEBauJidy1Bv+60ryyCSpb3o2+ro3krzIYK7Ll79CLSaUazIEcPDpBsXm8\ny9n7j4qjh62iQ3SvDcM8AJNLvBx4P2oOT7L/cKD5Yx6pEUhl3dR2HVGnGAVH\nZvdRmeVpr8qJ0s+6h4tDP5SE1Ptg/ePzweh+iDyPsVC8QBCdfeZpaWgJL5pG\n42fMtW42bEHkGu/uuscYg3iu+zjRuWhToKcjl+DlNK0JRvbdH6UMblP5ONBy\nMDct\r\n=Y+6u\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0_1533866240505_0.2152474635329158"},"_hasShrinkwrap":false},"1.7.0-next.1533868079660":{"name":"puppeteer","version":"1.7.0-next.1533868079660","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"af361c8ed60ac7710e57a2c795e2c09fa56d5837","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1533868079660","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-mN7sPt6+EHsNRo64elzlxvLUXGeEv0We43n7uqk2xEuO1bkGPEKdeYisaRXh5RQ5EfztobTF98GdxFNmc/tgDw==","shasum":"287dae0c91237bfbf53d11ef5aa0a51c2a4330c8","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1533868079660.tgz","fileCount":57,"unpackedSize":604896,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbbPg7CRA9TVsSAnZWagAA+goP/iFYVBYaq+jA/8Nb4M83\nKBErQ+wF38bT93hISUef/Ama5Aq6nlDp3Z5cxdrhH9DLnnvCDDhrQ4XePIv9\nIsZr/gNw0PsH2RWPRkye2BRHCINybLSO+/JfpxuQ24T1h60lFKB85lscKwju\noaw45enYyxf3F3HlGic6TbaikKnGSQGn2YGOfcMF0PtxJpogcKT0Xcn/lgnD\neBBU7Pje17ROXmEcJp27ugJgQlRHlBOTvjj+XXRUQC/qLKLz7YO+oxJkVzi/\nVQsCvCGMD5dpvtAADiHAEx1cU25Uapj49GwLBFKreA8tL/iwV6DFqKQdn3J3\nyIWbSOJXZ9PdiHlw+E4fhK/Bhz3QvttY0WZfB4H1Q+4VDCameJdV0u8ktgvy\nSCl7lXEPQLoB6RdoPpG1src0A2WCcb8XSM/eQbmouTXsP6DZ2j6H1g8NCAJH\n+oDa98DFjbmX7VEGgBg39hBFegfSQKCu5srROp6TdVZ65WJpKX584t6soEPf\nUqjnZ5SMX1XjkRY5/oqcLQE6B5LWREWlrMynufFfOdAKhHlWf3MTAa2tCbn+\nIIvLD3GsSFZNp68JomnwyB4CBV/c+MtGevF3NDr4enGtkBrD8tnS03kJdtHp\nTUgla82YpnOd3iqFmaSiaaqK60kinsg0GXs6URYhFGyZ/bHjm1sctn2hXfcf\ny8Fn\r\n=+pQm\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1533868079660_1533868091363_0.7687132171710076"},"_hasShrinkwrap":false},"1.7.0-next.1533868439500":{"name":"puppeteer","version":"1.7.0-next.1533868439500","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"3ae85e4649d4406a02882c543dc44dcf462a921f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## API Documentation\n\nExplore the [API documentation](docs/api.md) and [examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/) to learn more.\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1533868439500","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-owm1hK3SdxnslYqQ27BC60q7pBIdR/8LI2pv8lP+oeAvf8KtD8OLEUGYVaIJHk8td+xQq3w5+vtlVDa3ItYn/w==","shasum":"d3544a0d72440507902f25704f04a0c09eb7dc01","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1533868439500.tgz","fileCount":57,"unpackedSize":605280,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbbPmiCRA9TVsSAnZWagAAesEP/2AWpR4D2FleZ/um6bI8\nXq/6RLfNy13mgkJYQnZZgdKlh4u4PqSV4KLJm6iMfyMFqIBa19AfVcSFCj9a\nES8JzMzYMH5KcMcMD8G/Fr+tJBbYE4zpdM3g6G4XZENrVKGIBx5UZLptA85E\n+7HOjVa4WxV+hUPGuIZoaWjBjFBnUrw/HP9auSr/cSph06q2ZKW3VquNBFFA\nAzDGX1J+cX1Zo2mlpHULwmfsiayxPJ+fkNtqKTsgZMKdrghO49yqtOrZ9+cj\n1U+VtfHWVDYaGpvBxhB/JqVHWjOSaY1sA6u3TqHXkgU/4QrIAOMvUcRBGEkW\ntdu2LRlGkQUtG1buLnzPdg6u7l5GiAwl3caqqDgpkeZXaOe0Iziu7v+nbzhU\ns8o9JpD2hGZ9E0gd9hnbZoWyL3GUFjKLJHQDpcoSCZPrRtnmmTlYQW3VtS4t\n7XHszcOpfJVDHSRREV71aYlhnsy+i4oFVo7dM2UGM2MaohkMwf78koLuVoam\nK7LVCDcaIA0ns3LNU2D14Jz5TQJU1KTZsQpaFxkoZ8zXZit6KauDaifB7o33\nVhvZra4dzax1+nxx51ZG3GJGgUr4tpC5VPU0z2ZvQrV/q5NLhBMy1g1qjuy4\nKofh/WOlwihySG0gePLFlCG38ZVMhea0dJWTtmuYDIzRW/3FKmxXznO6IBqx\nxEBe\r\n=DJQ4\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1533868439500_1533868449716_0.6763375270631311"},"_hasShrinkwrap":false},"1.7.0-next.1533890337095":{"name":"puppeteer","version":"1.7.0-next.1533890337095","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"579032"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"b8e0d626f37c6c5e676b144d2b39ee29259d0d8a","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1533890337095","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-/YC5T5w3XpiCIRde+MRwzWmnAvUGKo6HjvBTHY7Kdjn1ilWf0+k61x9zCB0XWHOa/As1WMA1i0nEdEkGE1Asnw==","shasum":"2e96102423a10c1b4e725b4c2b0d4c1258f33493","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1533890337095.tgz","fileCount":57,"unpackedSize":605399,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbbU8sCRA9TVsSAnZWagAA4LoP+wSiYbVJAU4uUeBwUIOz\nOjsEc0V8D0dPvEGz1m/h0X0Uj9Y+50RZa/EEVMS2DNknY5UfDzKWd03Xmyx/\n47yJ8tMVPvO1jwC3gYJYajYvbSaXlXQci7rLLKoxdYFzEl8JUK9tuAstxBGg\nqf2+wh/Dqu7EQ7EETRjKpn5bPEFf8RYogHuHozRGbHWyypou8vCzFsIRkEPo\n/hi8zGBmAzsermHClityd+M6hmLmo6t6+l107cShAidhMk3E4Z5zlcPL5JGq\nev+bYUDwb7xrURhZdS+id1QenXA8HVICwyhnm31pBMwXuzSiyMOCTgNg5Jal\nYzBiVQ6kLaD+tVe7z9i+jNq6+qwLuGU/jeTIZqA6skfRbTKFKhvj6UhbYHge\n8y+K/xa+IIrsFGfTTDWwaao6WKezOUzTfI4XXk3fqP0hAINZfoXgTFUEUwlA\nUdJo9uiNbYTn+KIZWczqRhc0/ZGVtseFBIk84rfTJhi7L+g3xgnJMZ0OI7Sa\nzgtelbSLlT5OU29NBkVQy+ylzCRk5cqYFKWkbLDjyUSVxs+4YIL6B2bxFVwf\n8QBCPOsOvtdtC5tfs1fV4VA3cSeyYoIhFBJYBQ7/lI8oqeQp6cz5RhFcqmeG\nRkBz8h+5TYE88WRjtg2JM6pUaML53Dh7/2OGUDyhKNDGxhcafwSyKX+rV/gE\nNj0k\r\n=J8wR\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1533890337095_1533890347452_0.5125857278205961"},"_hasShrinkwrap":false},"1.7.0-next.1534384626788":{"name":"puppeteer","version":"1.7.0-next.1534384626788","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"583214"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"ce783274efd22d8b2634a6911c5dd5481f9f1455","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1534384626788","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-S/EoACQ8qXeBKs/JWT6wLsLq7eGgYkIXDOd/YI5l/PZeACHa57Qh2+H7LwzjtQU6OzZWtjQ+lK7g/AdVJjs+Mg==","shasum":"6a7be18bc22a42b048ccefb83f760fe1346d50cc","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1534384626788.tgz","fileCount":57,"unpackedSize":605399,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbdNn/CRA9TVsSAnZWagAA88QP/irNj2ofjmzxcz6UKBXM\nT1eHMYcXt3VtfYreKvIgzabJMTBhnm3/Q0b3sveJFAS2Zb5fzGONU01F/CAE\nb/v/asDsoLAFNYMcqoZIQfXp10OcTVZxJjy+DZJn0ZyANuGlAeTNgpqDT37a\ntgdAdmrcf6QUdwRWOn9aHdqZAhVK8opgwzEbNAtAUcgR7nJwSHDhmgg8bTng\nuJgMExPBt/odsCd5qZKJIVOBehcxgFmfvjo6b4nzPvfWDUVmSHdv57uIrwYf\nBSviFIak1rIaoEfPhiDADHuWgFeAUWUdu6KrBXv6lV3w3wItLRSt6iafGQYS\nNlK929qLA/4cINgHhW7Hmxo1Hm2NLKyxhfxb2CKrmOnmdaITyDefpvcC6qTb\naJBqDfLAAh3r7C3QDTLN3Pv2FsNSQ9LRpYTP7O8qyB652t41gLu1JvVv1kKZ\n1tj9q90SOXma0ryTkInOl0BYAC3wKCtiLrbEbzdI0YPw8M32fL/Yj0pCBs7H\nQAL+mP68w/AFyqJt9zhFd7xEdWokTe4BIZlDrjjZ/nQTOB4sEZv+a1aT9/WC\nIFuMpH3J2QHugRjDGoPmBCUflRL0PHX9I+Lz1zpTphbSJpu/9ZJVjpvWccLZ\nRXyUXggQI3DNaScp1k6clwMoovJ52atUxwjESm049FPFAC/MsDGS+4nsnyXu\ni5W6\r\n=YdHp\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1534384626788_1534384638642_0.8125272499986824"},"_hasShrinkwrap":false},"1.7.0-next.1534456245810":{"name":"puppeteer","version":"1.7.0-next.1534456245810","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"583214"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"395c50624cdd82efa5516201d587b7e578944acf","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1534456245810","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-/WmStuvDGzNDTDRYHCVCrUYPmKLZkJwBln+Be0RIzmK7dE6HflVvsLkOMnHCQi6tB//gb5hJEFWaGgPnAXNGZw==","shasum":"d49e3af7560b955c73cf7bbfded0ffbbccb436c4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1534456245810.tgz","fileCount":57,"unpackedSize":605399,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbdfHECRA9TVsSAnZWagAAfasP/1PzrhGlbWqP0lAC4O9Q\nUwyWIT5tdF+gcD2swZw0Yc4u3nPI/+88XKMdKvp5cgjfjZ9AYLjyJdwfCdbZ\nSJB54nPHxev1oj2lduTUltkBzZJF2XM0u+rgbXqnOUpK4+mCNNm1SQReOGoB\ndHSku3bgZXudlaKgxRAACysmc3ZxTxpIY4xpXLHsQ/YvkZH4A2B/5WsCX0BK\nVbmbVDu/4FngCxvscH/20/uXDyB4olIe8dZFIRDYQySvXknlpqLEWcYpLar1\nxRW9jkIIxIzUhbtx+F66LIRLePVnS7Shl0m1MuRF39OS6LLNb3Bmxv/eu92N\nnhT4WmR9sNAx9367fh6sc8yKSWq+XYC+h752mr5UgNabH7GhXgCY24wvBfWM\nYpAP9nYbTPXKv35/ckqMMZAINBaMz/kYiqLrEze0SS8KDpvLWTK35HEkF2XO\nrMIxaFUPx2KHvSdGTApAPdtqdR1V27sXjLHZB/FexYVqmKyxRMuctaV5OK3z\nnTFVzQqdOeQsSBv/3BycSE+8NfbZU1hJmFzkjz4nhpHVCfUbBKl02duw/MZc\njiSVA4tldImlRByT5jpTTjdjwvhotorIv6++XCOOSrLkFG6vRmWzPHLAC49D\nKp4Ban9iZ9vLQVJNKe/uyjinzkE9CplIcAyOWQVVILawJr0lmEst6qTczwI5\nY8kb\r\n=r9ZN\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1534456245810_1534456259678_0.4742471413148601"},"_hasShrinkwrap":false},"1.7.0-next.1534456313739":{"name":"puppeteer","version":"1.7.0-next.1534456313739","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"583214"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"73c43bebd8882cd64098a23e874a062e4de916bc","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1534456313739","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-z36xq93qPDAmODF7SaGR9OSHUfjKKqijTNnBPg8ldRKn8/59BxdO6HYhIUvb99SuWHrPj1Fgr6SpqMHRiM8Q4w==","shasum":"04d12dc680c5a70ad1fd6eaafb03ddb0ddf61f85","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1534456313739.tgz","fileCount":57,"unpackedSize":605399,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbdfIFCRA9TVsSAnZWagAAH9AP/2MkPEPZSrzi3kJ7fHQL\nDzvfmq74gVrj1wsuunV1xQR6AnaKxdDgXITHZDueRPwcEEx2d2INRwJ7vnMj\nHTz0RY6AN+37MIU0Ri6IqmZF1K0nidESZhr4Z0OjHct8RPxwQ9awatwLo2rj\nXrs/ISh/jdp6LLLzShGSIncNm+faa18TR8ko3QGXBXFhmPL51WcvE0+LJp/l\nQ91EnswVoJQuFLhuS0EviqoFZsdh6eivtGAgISedb18StoFWDwzfCg1odkcw\netykTFftw/j7HC2xrWhkZ9fo3VNHSaZX9/N8eTU+WpLH/7GJz8G4ihlTbNtA\nNzsjrOhfE8Gaq+/s3X3xLGfR/aRTG3E6MhtHtKJ+ocmqWykAdRK/MQGJyzAH\nW/FbgAKQUg92adw53Pa8HjV6AnIx89eKxozCnGXggcJ++ZpnHBs+Im+JgQ8F\nTzVJXwkJBxWEZV6Eb0Sjvdsevp/+dsYeVwDd5pZ4aqn5fFdeTQpf1nI9eiyG\nSrKvBZgCNwYj59d71TYsMAq6aU/JfxmBDgK880QdMjF3m2PvLlB+T8M68uBe\nOPC66qD2boeuE3yioP7LTJNHE2i2uVlCQX44DU+T0x3QsvPJ7UOEuRYTYQo2\nm/m+Fc1L9R13pvcTKcHc7KpU/u3PtuJeXsJDguDu9OmZlZDFTABKr+hDFyWE\nF/rU\r\n=fIV6\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1534456313739_1534456324697_0.6923250649066366"},"_hasShrinkwrap":false},"1.7.0-next.1534461562178":{"name":"puppeteer","version":"1.7.0-next.1534461562178","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"583214"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"d6eb3b4d5257cc620c417b375fb61c3230b178a6","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1534461562178","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-qR78zJws9Q8wi3GsbCax+7x8aWlBO72LY0+PgZTOe3FPBa6qv5nxiXVOXJKTBTks5ORioM2GTKKhm4r1ELY5Mg==","shasum":"d3af2ec5d4420181d85ceb541be1deb5e5ddb975","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1534461562178.tgz","fileCount":55,"unpackedSize":604023,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbdgaGCRA9TVsSAnZWagAAc0EP/0vz4XuNirqM/CsiS5Zf\nGldt0MGqG7cxKB9U9OFzc83cs+EmiAQojGEVswOHhYGR+D8pRvHJ/y1mkCnP\nareXFr5SH5igQN0AkIVnzmOcFM1tPt9pTR9u4QBFjFPs1sdTf8jRV1B/SlHu\nxtIeKrlkpEvMtGepCqhajgpC/TSMGSLtmnl8Y2tr/ZZ4BsxmYR87NY2hLOpz\nyvwniXU/adzCN892GoNqVGtOAFU4A+UOfhXkh4kAUHOmDVEsTbwCFm3zZnQL\nVXx5Eh9JYugvVx5EoZKT57OUKYDKRIJ8X0ihFNvD/uvBNchyIv8tyPI5+afF\nMihCKbeDXTsvJJ59d0U4jThjy4dYNTi1xsx5OyLcojgj/0SnId7Bag4OFkMr\n1jRdfkjAs+i9sW3ijGeYrfHQDdtf9nNInX+f+CLU6e3hOnaTIXBe3Wn7R6/s\nDIEzMvIEkcnFupIlZYhN59UhwtS1mMp8NPcnHVChl9K70DPYF2z0X/RAweIp\nobMA2zyf9b8wF8kO6PLesf3yeBNCGLQA+BX6OaaYwiuA9v3OeTJ69Tdt6MfD\njojabSl0dr+4a4yJHKt8dlIcgSIPTvAuxEfWiQlV10VvCSvm8bq1QXPW30/6\n6bOiVpLj9+Q7ER8uCsnSLwO+o5dostldV6KhM+EiV8LkKz1WjYwwkKkrNWSs\nM5iq\r\n=FSjX\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1534461562178_1534461573919_0.7313323056121959"},"_hasShrinkwrap":false},"1.7.0-next.1534528433343":{"name":"puppeteer","version":"1.7.0-next.1534528433343","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"583214"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"ce64ae22f45babb900632de54d8122d49e652587","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1534528433343","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-SGrzMQLORxatwwLXN4g4FK3qS8/etJzZEeXoB0tucpS5J1MkQaXfxNnEHurHcB7KXLMSGapPhkXdpzdSL/yNWA==","shasum":"495cf1476e7f5f8577c8a888b8435a146d04cbd4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1534528433343.tgz","fileCount":55,"unpackedSize":604023,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbdwu9CRA9TVsSAnZWagAAG5sP/0nBdgqJT1aJP7alVH3h\n4PPZZHk0d51N3Fsc0Ngv72BBH6ghyfd3mEGYeR5BRHm73+AM1ENmnZBEL/rE\nN2HutR8LPY7QHLCCdfLOtPuxlPUpqluASl5zT3wYkj6VKpwGLO8XGfz0DVHC\n/yOEWqnzhYqBLgr9S8sMpCvP1JSWCmb/tQ7r71CG9isOzlhugO3QeO4ekuHh\nzd7JiPqw5gVzMoKwfuZe5YSmbIijZagiqD5kb+uhEr+p4ZcAqWvGi+fTywVp\n0bcnLKAUQqHasuNQXV9kw+7t77r3f0xDDwm4LzRJ97cqKEUQ2prM5fPO/9/Y\nFLh3bXA2NsIxQIiQZn/jRQla/2nUjh2NgCtznGvM9Tkgm4eE6TBoZT863w0b\nxS5fCmJ6nS/dlqvgcfdGs1k3CsjQkZ8funiDRtOuv6EZGgAYtzjnFlB07hrQ\nIgv59PAIKUFZZZrJ0u5RKUVflw/eBe8fSLJHOUQlyHQm8IwGEtyLyxV0Cz4D\nXB2TTTpzHcAsekooRfvFRB35Sz638Fs9oVbLLmpqTtMo7zzubp+QGyULGRGi\n7YYuZlz9TWaGnAldE/XvdywfKFrdOntG6buGOdkrswzS+zmhplr5+bSSP+fU\nbY512R2CS4PS8yivKdUf06lYB9ZZn4V6rtC1E+ptt2yjYATAp3aVfOsI7VEl\nmN6y\r\n=Z0Yc\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1534528433343_1534528444871_0.06325536223446626"},"_hasShrinkwrap":false},"1.7.0-next.1534528770278":{"name":"puppeteer","version":"1.7.0-next.1534528770278","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"583214"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"d1105afaf8fed635c593bf2667b81e5b0bac1fcd","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1534528770278","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-uhY0fdBRmSFAWSO50AItg0fZbnDJEUS5w3qfbtVbDUUwYIgHdfKmnc0qDVIu9bFZ9G7AWvnrcECl9y+5Pd2P5A==","shasum":"3bd20e7e496cad825cccf11000f6166f1813b09b","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1534528770278.tgz","fileCount":55,"unpackedSize":604023,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbdw0OCRA9TVsSAnZWagAAKBAP/i9GFd8YE/VMHKx+dwOc\np2Eu8zOsfguCKnlQzl3FbxtGGpal6KZte9RGFFrDxOZRrBkjQhJk2kgVzaYh\nL/a6uMYiOa96mTW7uez8wjvLcGnukwWKaWQFsPveu5B+6KO7jLgfMdNlYZZC\nImJmXtVTP4RH5zNMvD7Grv55e3jR5XMp7BPsySnwYFjRsIdIgeHaiJzPtrQx\nznuWjv0Gmt5LduQOb1iCLQ9Afv6ImFDXKkEF7fi9unvwaNzW5hYKq1M47fN4\nbhucy//b4ttibaJ7t6TLcLPECcvVuExE67/w+WHlDAMTkA+JP3WJ3BOBV0pn\nKvY6OkeZASMttm6BuMIy/kgQLyZsAZgJ5zUmCRq3ZDr127dhb+bm6VCMQ0cz\n5ENGOWmt11NhJ0mMNW3zbuItOkA3Yqs6ANlUL0RhuQSCZoEiQpuaA/O4Yp0d\ntV/fqroEbxIhjA4gfM4pMo0GoM1VW3wFiZkaUK9e917RxBm1/MQebtIov/l5\n5jqqG6pJoT46VI5MzUpVMXqXSfgeXpdM8LFVWQJYH+A/nDirjwh4e6VkEbYr\n4lQ8ltoqlbtE0T0RChC8WQnlcRFvG3bWH6r1mSwuO66H+mkGOHLADBtythlT\nzdkJSYw3yTxfeiYsE8SuYt7e3FUHiuSRX6ywCB+UhiYjbUOqDihpW4yvgZdb\nkcBI\r\n=QOJ3\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1534528770278_1534528781430_0.1375604976285949"},"_hasShrinkwrap":false},"1.7.0-next.1535149239491":{"name":"puppeteer","version":"1.7.0-next.1535149239491","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"583214"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"3d7ae2a2591a55e4f94c67d62a22f7103698cba5","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170Mb Mac, ~282Mb Linux, ~280Mb Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1535149239491","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-3yjsXotMVNp4vIzvJ/QbrnLuar3Jy7cqddltEeK9ozKbSjgoT/Bg3DbCrdm5kwrTsiOZYwSuQE7LTfLTzn1GAA==","shasum":"f96f92055befacf57181fc8184518cbd7f7c78ed","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1535149239491.tgz","fileCount":55,"unpackedSize":604575,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbgITCCRA9TVsSAnZWagAAlXgP/A5NEKOK5kkycUKML+Sz\n3e8sockbVmpUwiQwKv9JuxSPmc3lPE+Qmga1ANbl2j/YBavRBKl+ob5U8jPO\nUagomm+0XkD6Hr5R220adz6m/xhgnQvBq2SnV/OXK3n/5nu0oW8zTmHY81xV\nK7cW4xXDXlYngYUvmf7/USknx3HpscruHeLmueuqVWlD6THjdXaY/R7wiaVn\nppSETX4p+N1UZ7V9PNLVqTSxSVK2SX4Rtuff8LQCk6lDZmKY3xTT8lPrENy2\nQv3gYX9FxvMZWWhpVlenFcxhxgahHo3Xeg7WWqtJS30fd5GhKgFThouHZZHD\nlosScWCpC2RAWmI/CWstJKHyn8CAZOkj7k/Bb430zgS64uwxWUE8c+594I8Q\n/F9J1B2+nIGf77BzjKR42L5HxzAgwPLX38X7i7T07viSjJYVG72hxU8epVz7\nCgbMZaw9Mh7tqKLFcsJm81+fA/psBQ7+lxZ/NSbKPIvqG6SPAkoDpTIWkYVo\nGpiygp0YIECnMQxWpoY8VIN9KS8RX2DORg4ceKWCL3hC9jPHqX43wPNp26xD\ndWqAHoZ2NqboeGYM7OMHoEsbLRx2OST5fUck1tdhdegMqXtkwBnRJHfRUe5Q\npB5dlWLunZShzD5UurdOL6okMmPP8urRvhNffSYR0+G8v/JBDCLOU+KuHrmm\nfiNJ\r\n=ZALN\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1535149239491_1535149250187_0.16659192384212784"},"_hasShrinkwrap":false},"1.7.0-next.1535561219970":{"name":"puppeteer","version":"1.7.0-next.1535561219970","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"583214"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"bfed64fbf67d8e38a1e7e3b936c9182ae6d2d3ca","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1535561219970","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-Wmtq31TO7vcsvpXiw/VEZe+ujnkBmqk67ciaCznh7kOoDtXhTvSzBSxhWYgfBnXChNucfBc9aX6rBDtjWG5r2g==","shasum":"3648ce6590286bc86451221523cd58fe72e160ea","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1535561219970.tgz","fileCount":55,"unpackedSize":604575,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbhs4RCRA9TVsSAnZWagAAcbUP/2jg1gSmJT2NGz4fDGK7\nAazBLlnQ20KfaSvXRLaNGdtmPWT7JW7pS+tquwsVyhWVA7Acho48kVbA5Vya\nS5agKiVJGugKo6w4Pbw1P2SXTdA4lb0MNKxwcjqkSS9w0V6MXppgJX4+pkui\nT+FxGlGNTkgYD5bI94+haIdvk3/Mdw7ki25jNQ31t7SdC1fWJjgsw7ugnEsm\nhfGdv/tArC60C980Ts65T+rqDWRfdYt78uXQi+CQPd2mBOqZG30rClCaG9X2\nnh6OU+OhAQ0CX0HerQiqZLoEPqUC0uimhP7kv0+g+bN8tzDGGBeTHUecyYSu\ndZqMkOBTFdqvpr3zt3zThN4sd69SLdGQZvqJNN2tjbI0lSorSchh1rF2IEsc\n1xRXnNHu9uSBRsnXlXGuESWdTc0MmSRL3OOCWCiiTygj0G5wNFUaiYJFYJOY\nktIf2iQjWMQjXwzLoc7Rk6b5vwqhkBYnGQpzVwYYaiesuzU1T9VHxxJU4YwG\njcgMK36p9NhmX+udhftB92XE29tINEc83MaCJDWRVufL35qrvK1nS/A6Nrc6\npk+1Xy2lKbEnPc/rjMbR8B9MF7GYt20jnCkIC1r1EHa3G+tvKQ9q97lwhaT0\nbfdu14EE/MCJCPy55w0u8l78tpDfApV4RAF0Q42gwSgD4DRseRg8aApKohCr\n+oZL\r\n=LM7N\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1535561219970_1535561232244_0.3367344598089732"},"_hasShrinkwrap":false},"1.7.0-next.1535587532424":{"name":"puppeteer","version":"1.7.0-next.1535587532424","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"587164"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"df459ba6cd76c2bc28139a1d5de7037a71f41161","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1535587532424","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-rPAVRM+F6yHNEabv6r2Xlx7SSPDbZnWdWCtgbZAbu9dTZt/LUQQCCFbWfL01FXQG6bxKuCBQS5AxTgPDviCjmw==","shasum":"e3a40a0efb5b043c91db266656bcb914c0552676","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1535587532424.tgz","fileCount":55,"unpackedSize":604575,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbhzTXCRA9TVsSAnZWagAABvcP/0xYj/Cr6lU6H0Aqpcm6\nA7T+I4kJSbSaP1rnTy3k5z1Cm73QuG3UXZjvRQ+tqM0dxvT506SOJboBeG4E\nnSaQgjgRmiqD/Ob+Kcta5JkMvlfM5O0zaUEWx36iNMfHuX+TSBLXnNkrXVZP\nukoV1Z5G/i5iDTPc8WrZa1JHI/alug9V4zDHjLUWNsqj+45qKtJ3LcO9M9Xj\nHmtCtC42fqf6QWk7WVWIUdY/475oCQwjHNyficXBwqlze3ncwK8vx4uU/vjT\nDa28ZuqsUpQm7xFk7YMfFyStC4XO7AjBVoV7unjgT531yw1UPFebNczeVx/p\ngJwroYT0BzTs7PwPEHuck08USiqlPBjfv5FUhboYZ50CZ7PRQp+6Pm77Ei2G\nbO2vUoXy2C86Eoe9v3dEsAf0spkllXOFwAcEVaavajRGekJB/Fs9ZWYdDukk\nexpMoji+BgmETHb5dtMn4Fx+3kMKDzgqQvS4iqRNTrK8/k/zh+LcqVk/Cfg9\ncu1di7+uh8bwJ8Epmxcim+QscVlJDz4By47kCOMsD1oJGQk/1Vncq1Wkb25T\nE9WrVQtHcqNHgEuOo+YLuVmP4AZJVTzosehe6qehHmTnL2/gowgHtpWPMjtz\nEL17JrNIWSL2uKq3WbZSELIc3PjG8i36pzZJkXzpVAobfY04/WoPrU141gmI\nm9fZ\r\n=R109\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1535587532424_1535587542682_0.12610262650215476"},"_hasShrinkwrap":false},"1.7.0-next.1535668689898":{"name":"puppeteer","version":"1.7.0-next.1535668689898","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"587164"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"50d6c2d3c620ad733d959f1c9b199ef932f4bc96","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1535668689898","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-nCP5tyeBmf15qlnDnvS7VUTts1gAY3ve0IG/X3gOlmbGFqWJUjAOgKoSA/tadKL77Vxvzl7Inf8Ne7vyMTvzmg==","shasum":"b6ac71a3bc05a4f1a72ff9a2bfd9e8be960edb3e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1535668689898.tgz","fileCount":55,"unpackedSize":609057,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbiHHcCRA9TVsSAnZWagAAmeEP/01UeA1mJhfYGxKrFLdV\nyNKkoyMxNKIjvK5DrYX7YKqfw0j7dhwOxx3MWWB6gRsYXetiCGGzr6dOm+PP\n0nDLVctkcT5HyTSmNFlGt02ziIC1LUUSdfkD53C+yjOY/KrsK6dP13s+up0l\nNZjvTRvSJUPZuweh8PciNcVZBrNYjvggBJ1SEbp6hmWNUguqICPxxt49e2GI\n07VpTTglqI8+6lFWP88LGZBa8Iws0BhmcMa5w9djSpZkDpftepNZP1hVSrwq\nQmGp7kNO5PJFw9ONsrF//ITLN4lhC58QuGamB4ctL2NYKEx7k6BgKRxWVmTM\n2Dd71BepV66FOspQTiMU3CCkcYdRb44DUOvix1S+Yn6aYYYmwIq9a+tzLYyI\n9S9jCGQSJokpKXxgL0DEDTxkWsjf33tQVYRtQNjStLVsL2xypQdEzRZoEch6\n3EvZaM9Q6RXv2D5ujsG1u2+FicglphyPQ85fg9VajKDfvWF8MlrUwzQzcyXE\n3/Lj0azV6tHD2fu2Wnx2o6Ha/eUlH/W+iYOC3lgaaidSW/+Rw4XiCC0f0TGw\n3Hn/D/6k8rfNX6Lz+bLVbmS5RHasnnvquYkPJQAqDTKUXLi4Egv2LJLh9DoW\nrOyEycmUlY+9IlVjLZ5DbOg/pfTXZzcNlGs3TilJeHkbO/RoLpSiES1XFDDz\nDA5G\r\n=Lzqr\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1535668689898_1535668699280_0.29391055989784687"},"_hasShrinkwrap":false},"1.7.0-next.1535713393176":{"name":"puppeteer","version":"1.7.0-next.1535713393176","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"587164"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"10009973fb1364dac8b0f7cea43512c088fb7f64","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1535713393176","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-jaKFr2CVElbnqM99PD8SsCeBRerZDBzn9CNwpq/HSUWCFREupzRKn92E29QyO+wFc6qHU6DW1hsdNDBf6ZQteQ==","shasum":"c928aaaf1c6c249c0ba671b5af6bccafa65dec38","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1535713393176.tgz","fileCount":55,"unpackedSize":609057,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbiSB8CRA9TVsSAnZWagAApvkP/1DM+SVzw6FLXgx3Q4k9\nSj/d8lRJaJq1bRFMRGSctmI13BtSTxI6RZKm7/6kwYNFtHk0Zh7SKBVuBCek\n5pLc6ejQY2bYiF1xCkcObFDk+ob9/vb6dk6EMEUz9VIV1ABvGQcOswcKBEq+\n0G/K4Uev1ssQG0KjEschTpZLuCd1OXqpgXFEY0VP5CfcuviG+qlGdrAakgvg\nREIQUzO4CcNM0Wi2rPFHwaYZJg3UIghiPmgeObLnY/3dGeokkHH4VcP9oPZm\n9WLp0wDsdRkoRUPMOwDtujbSoeX5hf5hdWiL08kV4Ngk3tlaOuQoJeaB2cbq\nuil5otgf51xMhbxQcsDls1liUGwLUxiJdjQQhsSB0CCHJizTG3FC9mVidFdH\n6agOx6Yh1+XxCkK99xFmBM+OxaDvmwoJcMV5Y7Ymbv82PwweQKu424e7JCD8\nl8Vs4wK4k0tvn3ovyfKBwzX0LfB19IKEAAMU5WAYn2M4lE9/qee6Wmk/1aY1\nxlypp+5XQuLxVsLf7QIaX+G3UD8QepES8cMXkyxbPuRqQNF3BNWPzK3d8Dn4\nv22rlak/hIlaw8cuDtdPzSKFhb3yVVdHEJLnzQI0uELzal7YGfsjjUJYqEJw\nJb1GxdZSgpLgJqIt+LP6ZXzRNbw5TFlcm2CafnKONzr3FAsOcJhcfMaHirvc\n0S6g\r\n=HcqT\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1535713393176_1535713403957_0.4807898303441487"},"_hasShrinkwrap":false},"1.7.0-next.1535735247500":{"name":"puppeteer","version":"1.7.0-next.1535735247500","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"587164"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"17029281a92446fcab2357cc52dcdfa7239aa4f5","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1535735247500","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-tBIlDuhYSa1ldEK4baZ9nj18i7dJMAI0UNrJYFe6Fz3rT0uuPsFgD3xMZFFsNNY+Sttb2aJNlqFo4+RslDeAnw==","shasum":"2844e3218c2ea15fad9386d2d85b376feef7750a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1535735247500.tgz","fileCount":55,"unpackedSize":611073,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbiXXbCRA9TVsSAnZWagAAC2MQAJxV4shBoS5Ehx6uHjea\nCEk8Y3yV0YGhnVE0sV5Bnrdeonw0jNxgAv3q+Bfu283PpkHxx5+mt2/Vb2yI\nICA0UeLqyLMe3xc/aplEkH+IRpaat/xuBVD+apcWPLLodC5Kc6r7qYt/ko6j\nNNxwe/lkB6NGGGH5mFIyBeYV02SqpqSFhMw8Ru8d9eUME+owhyENAG8toLNF\ncWmHvFldZ6i8s9XGzed2SdUPB7HFKWjQLrdzKHCVyFxjr9EuwZzzQQJ2tIr8\ng7HVmbH0e+xK5DxqOACy/KRvTH9/VswOPhLF2fI3whQV343SfB+fZGVGfWx2\nVJZ69GEPUgc1kgY1ENpQlWqgoIeuEV5BltYJLrU1cqw2k28xeMH7vZo5CF2v\n2vEt/mxfuzN4uCG2SKLkD9VlUIU/yO87FcFZA6YTaapqX8lH/9gaL+097L0i\nhYNsSc89lYM5LYIcwLpg2f4hf+o8qzaZ0kWZga85bsVycd0C9oku5D3K0wrM\nyTZl4xXjO0kLT7yWBn9SYQ+8x7kvJ7/Xt7JopQ2mMGdMAm1cn8+fyH508KhS\nR9UnX3Iu0eLF92Mccsad4aP1Az8LpAZQuFfChArgwYFMQMyx/PW0jTXSMTaL\nW2MUDeKyQ0pMIQ2JgvPHM+YQ6tQgdteHo/cr2wOW2xJehHvfkZtU5dk/L4K8\nWxU4\r\n=nMJk\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1535735247500_1535735258230_0.5625219381875102"},"_hasShrinkwrap":false},"1.7.0-next.1536001811008":{"name":"puppeteer","version":"1.7.0-next.1536001811008","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"587164"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"464f3b4ca28563d799f40a3c647e3567b4f1cd68","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1536001811008","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-ToMjdBEZa9zuO5kxgimiMG0UXKJtyxSHw3PVeEsug7b9R931jAimMGBH3JeuEBNJajugNJWtyGEG0ZqbKHXdIw==","shasum":"762c2f961cb34f68df925e06dd22522180b22135","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1536001811008.tgz","fileCount":55,"unpackedSize":611185,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbjYcdCRA9TVsSAnZWagAAZ3YP/iJFogYRLxYypRVhNAt6\n6yrAPOfGefj3KjsfbAPD2mk19pLQbhl95su2dDtgzNdUlPzvDwEEGVHm8oS7\nRBlYGRGr5jV2nooRpJL0ivRJZswEGPMNkibXFKGwjcKMgRBZAsBY8NGl/4i8\nCLxe6QlCSjwP6+Aoe5540NwHLqInadreOKDug4rQeFsNpyHTkic6EL3qna3a\nCXljq63V+NpoTWs7AfeGBZq0lyN7AfSMjNmPdYaORWFVaNue26ezIPStfM2y\nLVPbnYwFgvgGoqjWT0YkFfmXAOnTojzDD7e0KF9X6nuTz3hQQtPhyuqIIW5V\nLkSnM06e2Yk5vuxD0+pX1cnvlMdmvjQn+J0Kzqw5eFgr6IZsgW6wzRcKui/t\nF2WqQGJxmq6CjPRco8IkbVWVNJ+o0cJvJiM0k0T7fA31YgavPY9ZIPSiB2yn\nU/IOdi34fjRJLtaB0/1X9Ft+AtvJ5S5c3yLP6s1Qs6eX0doQuK/otvBo+OAx\nyv6MyEMMkIrhmcYSoJ2/kDKQkD36i9wQ6JErtgS68WF591am5d0p2lS8dWAj\n8kaPAK4GxAFibsMiDMEUjtsOOhMBSg46XcaSF6oSp14p3jiwwXQZRhwzOpSm\n9JfxVja3eblIRuIAcODksR0Egz6ue3QNq7KTxNDbkICH3Nub9ZwNYkP6ysz5\nGeVN\r\n=lmht\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1536001811008_1536001821167_0.4985641611205067"},"_hasShrinkwrap":false},"1.7.0-next.1536052077376":{"name":"puppeteer","version":"1.7.0-next.1536052077376","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"32c0363adefa39a418d0cab1f2d2a818d391f017","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1536052077376","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-QuDfLiDzldJuCgfAaWbz/A2XyXhEugCYYAWK7zoUyd5C+Ybj3Cg1KPt4nRIB3c390gE2vhp9dyAQqpuJG+2ZUw==","shasum":"6cef83492dcb7814fc1789484e03496aefde9ed3","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1536052077376.tgz","fileCount":55,"unpackedSize":611185,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbjkt9CRA9TVsSAnZWagAA65oP/imC4HSqcR9XaJaaITT5\nA6p7J8gXmTkVpzoPgrC9k56+DaDyIEMhAT7EL3L1zEAMF43zoKu1wBQO/YWk\ndU8jo4YaTr5K3ir/VDc9s96xdic6gTOCHzqb0IEwc3pFVn+Ha8rGwvBpvPpF\nyJ0kGsvlKWFNJXDdQq6p8LDV8zwdVBuN3qrg9wrn7mUqC1PY6ET0ktAvaior\npwH+ZwohKjw84/E3VDFfUjKrZzQsjixTBBVjhiftiG4WT2dZ3BjdGPmcPfCh\nyV+qU2+eTYYafqrGozNCdoNAb6oRGlqZ8yRCstd/uYBfzvWzk/fWRdAU6fNN\nTqiMogcznHdNp+7SoGMNEDRbhOlo+TDR2xp6w4O4+IvrVKCZH8oMIgnVzaGM\nu9me2SYmnRl1B0Cdo0GMgRYjifxZkyVYp2/q1l2MPLEfUdAo+Cbx20WFuI+d\nw6PrF3fIDNG4fNd1N+gxn8UvL2xMuSz07aOLu/RFB1USRueg9m9kgXhyLJNy\nfJs5QmA4BxZVoE+ze6Ty3JQzIFBQMDqQPcRA1w2eafov5Jy2xuRajqma2OnY\nlY6/xh8pOY0toZyRuAIBfPye/ovHCxncZBliHxi614gBKsTYMtp7lFtHKX1N\nyDxxYWd09BerfwgGBOhMzkXZ21DAcq3kI/x0F3te6mrdIBY9NhpfdboMeIZB\nUEfI\r\n=759a\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1536052077376_1536052092439_0.5695062053223248"},"_hasShrinkwrap":false},"1.7.0-next.1536075421260":{"name":"puppeteer","version":"1.7.0-next.1536075421260","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"cbce839986e24999239f1bf7bb9bbde1a7576e08","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1536075421260","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-2ZX5hymywXxi3Q/XXXRlcu2n4rygEUNJjPQVJOOR4EFaIuL9VdDM+5Sk80+tID4w9b+NPaM93tqe2B5QVKey5A==","shasum":"5d68cdd35f10c1d997f2eeeaf92269231069523b","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1536075421260.tgz","fileCount":55,"unpackedSize":611185,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbjqapCRA9TVsSAnZWagAAJm0P/ih4dgfnNqSnWaEkIhS9\nyj1RC2dH0g8JbJ/wVpXonKHKwFTQ873ImMKQlsSugvevgQWZyaN5+XYf/+0X\nlNVp3bz0UHES2AgJ6tWrNVuHqBMd8pJvbNPiNaOHQH31tirnC2yi7aQfqGI+\nnlpVDZhTHaZT1zXeI70WgQ3ykwH38EfihpI+Zpc0yD/w8jz/xQMF9KzA0es/\nfWYIi3XDb2V1karnXGE55EfwV8xyRSEHkEWnsW/kvygmyMQObcsWZPot8gmc\n9uNxSVQe7u/H8gw3GSjy04Ai7E9wwL+cNmz98/m806m7Wbfr6Y7wdHjuSi35\nd0Ot6IaxT08FtFmhZd1qSa37nBNM3LLD0EbD0r/00ZALVbt46CoyegrfTWZl\nCFF7ZM8dEOal85XSl1TbLfjys0TENgZYuKLpzj3WCa8XRGjAubZQjv19cRjB\n6DZ4q5jixUnkhcnUZKFvqXomJN3U9aueaYYYO2TGtJP1OvCwbukMYli6Bxa/\n3lKwjbT0B/XeJYovyXVmOkQ0Uh0xoMFrOq8VAXKaLmxDKdpwtjtZCh3AqPnx\n6bKAfwXk1yPWj/5f4R/nz1WHaRHcEFz/4uCpM0asDCR+ntSeRfd4crm2P41s\nnqN9P7cBd/tljdtvRpNfvHqThW8UnyPtT1K4o8/iSFQvJTFw/H3shWo3k5Jc\nKDzV\r\n=Arnj\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1536075421260_1536075432331_0.8030331259419095"},"_hasShrinkwrap":false},"1.7.0-next.1536076579608":{"name":"puppeteer","version":"1.7.0-next.1536076579608","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"93f267b4bb0b5114ae5d89aee26a18d474f53889","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1536076579608","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-LTnKcz4+/GIneK5OoXhEtiRIi2OpzrN3ncjs7emuhrWpJ13sfLoI+Ir6B73GzsPu6v7O6qnRsnAVNPd/F0adkg==","shasum":"58671fc05ea2aaa04f6e49450096bba7881e2966","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1536076579608.tgz","fileCount":55,"unpackedSize":611185,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbjqsuCRA9TVsSAnZWagAAiecP/3iBFMFTItEuCqkyzQh5\ngZktpOCEF3CTMA+N2BuAxGfKMxmG0qkhsSBrsCDq1NvVPZ1L1VIX/UWUUd/z\n1Ky2baJO5YtvTynD7DngezDYJJ30yhgDJEmAJ/QXtaXNChJ0IIN5jeNuMa53\nKQ0ExPgRYzAyV1u72dojI7PjUZu6OGebWyv9WRkyCdyCOC+fmqs+B/9e2O/n\nqbqmxP60SnBhwrBlNTo4PF/Q9CIn9Be0jxEhtOT4JFwDzfhOt0QDbfNyKxEn\nevM2po8qZNiryZHSV/ICh3tweVX2npFreWGJEzd0XhOr9VH842a3K5yqnDgw\nLbjJyw2dcUK2RHsTq9YrNIAtBA1MKnFSLa5ixzVNU6Qf1Dt8iX4l2XfBrpDW\nlhaHS6JNnIh/ut3hn704z80J6fG/IneBjuLfFJQmB0HyKc1z+ySEgvV+rcTs\nnJjBThHxEOt8lNtVTEZ34dcAdrE2/2PUrhkHYCRNTDAwZDpRek/8uYLLpgl7\n1m4W0RwVwETCMeB2LiuADOeB8t6EDcPsISgle3lLRAJZuBdSnfmlpblhleQm\n/lD8oFQCv4K9wY2IfHA/O+PC9Q1dUF+UPpCUL2yDJZJe1/MLRYnFWMUlk+eY\n5tnlxPZOVqRLKu2/FbmunPN03w4l9ZtTE8lbCZCWT5Diz7OFL3chyMnMNzw2\nioMp\r\n=gpNA\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1536076579608_1536076589711_0.016863414804004107"},"_hasShrinkwrap":false},"1.7.0-next.1536078965668":{"name":"puppeteer","version":"1.7.0-next.1536078965668","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"2de5a42d1f20b5c9719c8c5506fd772d73d7ec70","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1536078965668","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-dbK0dM/SEHuei/TJME732Or9i++nGxJzn9FS9phhBv2JOdZlWz79jAt1Z1RspDlomdtUldjgyscA3wxtFy4Ehw==","shasum":"98a21a48545093f371126e8166bc79677b6a13da","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1536078965668.tgz","fileCount":55,"unpackedSize":611316,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbjrSCCRA9TVsSAnZWagAAtYQP/Ap5xz3M9MQbqMMhAMNS\n+ec64E1IXuLJX+H/MOPWkpAba0pwAOClQRlKLyZ2TXUdg0OsWiW2kdIyKTGt\nJGYgkeEPHUQrv27XdOfUzsVrhwm00ew+3hj2bZYe5QSL84ds58jZ0e4RHtGY\nq32zHthjVEm3ub+yFIK5D91GTwlV8JybWrYA95LfyO1Q4IU4/aR+ZNfuUi/i\n0RSif0Ad2la9QIkxNf9fqo98sjD8/RY9+iDy3RrJ6FVkDNkp9U7tX2RUWwfu\nIRcVfRqeNd2xfEIxgnZM7ktHjKosNxMMNpVqKqzGhy3lzwcrbvxMzpKZthGw\nE7mGsKfHMfvlWi6kWr8Dj6jra4zNELHZirVwIE5r+IgLrQ1LGuepaRLy3Kx/\nZ45BDwIYx27H5JI9XNirz5CgV0KXpvIQ4wv/tw0Qq6pgFdPcf55pi3cy2F8G\nU8p5SGVggMKKq/M+LLc01GGiPcV83w7695UsxgIxZRqqVm6V3EK1EFesmLzL\n/Ii5IgJC88Gs2ZP9vqxKw/uHBMkZgl6DipLHh/+IEY+CEg8CryNz20YZvtaW\nmjusKYAEHupTtMzWREpBaZeJgnsZZEYXvvCpxxPRpMOwwI1eix4skVBUIHHE\n8pXCdmiZX6qr4m5vQdxqs4OlsdWHrkc0bP902rGHWZrPQ3R65F1Rd4CwmbbH\ni04U\r\n=jdgt\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1536078965668_1536078977641_0.17693495922900038"},"_hasShrinkwrap":false},"1.7.0-next.1536084551248":{"name":"puppeteer","version":"1.7.0-next.1536084551248","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"22c0ce63ce4334047df6c2c8457569c191ef44e1","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1536084551248","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-+LOhbsNin/FzKrJP76JEw55OWRI9MrKpGRKKO9sYFzOeahSTEFfgJj9BkfwGw7jPSOCbH4ywNgvIk0/VpULdkA==","shasum":"d5faf5bd04ce131cb425b92d4f3e29a5283e8c0f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1536084551248.tgz","fileCount":55,"unpackedSize":611316,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbjspTCRA9TVsSAnZWagAAmAMP/2fCOXo5w/9dGbrCtwR4\niHWYCtnFpQaADnDYFlfvrWreLC1qlLKKsRHcOBTxjT/2J619Ra9dC6ubVyBE\nzfupZ/N8rkv/3xz8yb/FNrasCgpIuqtb+cPLtpZmlRHRH+o6RrLZ3KpBW3VD\nU+0i3mSVkU8fSAW+kOwcUw75lZb0Wqwik4HFQxXbj6gwpYEBS2eqojmo1mKf\nLRmPkW6JNYg1aPdYPNU4t4cqM8C7iVqIuHy3STOoc2Ql9ok1Ipe5AnhGuDY9\nsrXqpC9hjD9nA3IoYKpzG9BsiXHc6RgwRPCZh6WeTi5k/Yg5ZX2EsknE28N2\nDmIxiMlSAi6IlH7XXPm3Z9sNTOS/57r+vb2tA7ctFVcvdd1f7tV278c5os8k\nJW9kSeS7Vm3II81FLPWVYtpB/4eQEWjpiLYCj2FYDP0rhGh3k0mK/HiWRk8g\nVwlajs1Kgd98x4p7sfvxTWaV7neMVwW/tdZQTgApdTi+WyC5GO254QzQbGJx\n7ynH7Yz8NPYhG3pc+xTABR6Abb/HwLj0iw7JyQ6MQX+KADY9EwywrSarzPL2\nqzn2PD4iqmXmaihbAIcn+JhmZPKn8yofAU9Afz4+w2j/lFtSNpX8unGHJxA1\nBMLZbHnmRwHk+kpP55ujUyME9moBTmAn8hO9tLLTdqxlD4lzMEBOuKsoVnyg\nH6Eh\r\n=XW7Q\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1536084551248_1536084562696_0.41292934429873407"},"_hasShrinkwrap":false},"1.7.0-next.1536089048222":{"name":"puppeteer","version":"1.7.0-next.1536089048222","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"52cf16c73c48c3e36f90460f5c8715ae06a6415a","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1536089048222","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-jgJficKHp/MoqVIx14JWVDW0UGK2Z7Fe0i/39kSirNtJuZEEqyDpdnqhi8RGCWVoDgyj1AaVZNLygGBMj8+0HA==","shasum":"faf91b1faa69b1327cab136c419f56e9fa4e9c09","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1536089048222.tgz","fileCount":55,"unpackedSize":609588,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbjtvmCRA9TVsSAnZWagAAEYEP/0hsDk2eJs/Lp6vBop5w\nrghh6fItaEPkiG/3N8Pr0BuxfBqFUDSPPLaGmvKWDCPRm1v72R/FGnZNl2Cj\ncWCbJNe78NH83/bnUkilUByTonopyzeWgoQMiicgJD/w+Bu3XmEDJOCrm+2i\nJOj4QrYywZDxY7Flmjl9ycivJuU+GK6umFOaj2EjolyvSv0mkdChLXRsXyqs\nfo8PrAIdsIWmk+CIajNAndi5BPkEgzd6V9GsPGisaiGysPz6qWAd+r5nGbRX\n9VRCRe2mj9yjEDcAlnOAs02afFurC37E6lroUJ9hciLTraH2u5TbX64qc5j9\nCdbAq/Yelw0XDMOwGi0207e1sdkHITG3lex2hDntdO+wAoewnnUyKEpbP8DP\nfKW8QFTZKU9LSJ/ye+kfhgBIbTuN5/8MuUgQl2cs3OAeCzX6RjKuVQXzZv7T\nIFiGfIfYHk664f1n3dTUYq8V+NSCNPMG1C3AcC5F6IUpa+sP+VhrCj6xvdEl\nfE7HdCmsosERU5HczCX5Ypj9uIn+hJgB8fP4R3wCl+dk+YM54+j7kkcODZm8\nN7DYx9v5sYG5ou8lS7fgjMQK8Ue+qMDucz9BTfEXisyAYjT6yEc9ApPlPAmT\nlRf/XlsZmdR3lnf3S2d5dA9eG5t+TBbESic9tfu+40ODYR1EiGYw8FLwYyof\n3Iu4\r\n=CZcg\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1536089048222_1536089061900_0.23001468185612195"},"_hasShrinkwrap":false},"1.7.0-next.1536090149346":{"name":"puppeteer","version":"1.7.0-next.1536090149346","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"1ba2b8540dc52791e70c2f2c076f50e135af3b75","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1536090149346","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-37bqyWdOegM4X5mgFa8RT29bxwSJQdclE3RGCMV8tgovY15irkCETYHXV++L7fqB6lnG1yl2atjNQrrL+N8bqQ==","shasum":"bc83f8cab790b0b6f3085afefe217e7fd1d891e4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1536090149346.tgz","fileCount":55,"unpackedSize":610046,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbjuAwCRA9TVsSAnZWagAA+1MP/ig2LKK/Bm4wbWnkFJH4\nry3z3pXgZLpHt3dw0qdQzgWUXDOKckH6VGHTxNBwDSqk3wuAy+/mL1Sb7G+p\nKL11OyJhCzXIOD77zeorCkbuwbowcSZB5wCOwJxT2FsBOzpAUZR/OX7GJ86N\nGTw32rLuXL8/qf5LDSozlbgJAMugPADFBl+esng8+PIplKWV/HAD97YUGd5J\nXYymGeXkisAUeFBweap7BmeDX5qp7BFI6Rd0/1TfSjGA9N57ZmsJmsGlNExf\nABoiKTUbU0yYGuvoxg90LIFyl8/SJ5b8NE4ZqW6oCa8dXl1X0/4rGqJpBWZI\nHu/PlZv/S9iTjfqhRmeTtSTH7Z9cHPzqXHgEflhnKZPQ9K3yzKrSX+R9Gq5b\nZeXNmLcQFmnAUcVTeos6+jxFj7Ccm/o5tUqpbOGS8R/FjyZgSTmnfHZlY7Wq\nKF13levW5HuMi8bAKBAC5OnS2YcuzQzGBm3fjE1PGazyL3T7NREJweCuy32i\n269aMOWP/VcvQ5BTXCrtg4vIrZ3ofBGh1iJmUD25zcEmpqVQ6AMySqyxcDOO\nqpyNADvQBm2RNoEnkGKYXRIdD5GIJNVNZrqGrhq9IbbBAnq0zQfnhKO12C7j\n7gvbmyLOHFCqk3jOIrW+EPsXn5CJ8nPbksBi9vMiyQkUww0vx1imN6f9hIHr\nJb6z\r\n=kNjp\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1536090149346_1536090159713_0.12110162494350396"},"_hasShrinkwrap":false},"1.7.0-next.1536097322757":{"name":"puppeteer","version":"1.7.0-next.1536097322757","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"e07567f26838faf08fff004466ad5153ceb55581","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1536097322757","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-zOrEbUmTveTMs+MchuR5OM4n4hsuI0rW9p6E8CM/mG3sL4tGU6PfUDK155edF5cYIwQzM86v/p8vfo8FtM6ycQ==","shasum":"69609b2eda5c7c8c2dcf512727e0b2949087dbb4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1536097322757.tgz","fileCount":55,"unpackedSize":610046,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbjvw2CRA9TVsSAnZWagAActQP/1Aa7WAwdF61Xo9wdfXR\nc6FKnJjm2z7LPujO6cd+yUN6qQV3hObH39inqQDnC+9+GMEpuorHlLwCoVZ6\nwBuLZ4BktnBXZMWm1XLBwhvVrUOvb0R2r1x9LmcQvHJnaU7UhSDhkCPfl4fC\ndEiSHMYI1gkjHGj+LqucLPy7dQ84FycbvZ8liLIBugCytk25zybeEt4dKutA\n2864y7vCKXdbvwLK4g+qhRIdqtyWsog5q3xz9JI39GQHs4qB0YcResk81HcU\nqKFi+9SSCu8QTD5Jvp/4Qkys0PJyRp/PXXEi7OmES8atWuJBOwJ+xYFqUIvL\nQ/5MRfoWAhroRyXU1CoYxCPqU1+BdSmd4yZcACqh6JbYpiQymt9XkHe9iYP/\nLJEM00BDDFtnMIE89SxC+z2WoFF0y8vbGilqbHjkj1HmYkN/IfjtFIAZ3Pog\nJijBIvsJpHDTnqc0Xz7hQznRlHojWFATzpcaTmK3YqpN1GmY+Hm15e1I0xJY\n9beUBgiYNODX/U3wKb2txgurivZK/U8y31+6VTjf2pBvdPoDdd/XVV5uqgVo\nAWGBf4m2WwEOod+xV7NAYbV4c5AmduRYtlK//Tqi49KvO/uCtQRjJ9t6tUHI\neCZ1zfOdEVC8n6s4VYhkGMlEPiIE4OJ/G6u9Deuq253bpcQXuJFfxpSVWIP1\n4IiN\r\n=YWa4\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1536097322757_1536097333897_0.3235029054093672"},"_hasShrinkwrap":false},"1.7.0-next.1536167692060":{"name":"puppeteer","version":"1.7.0-next.1536167692060","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"3364659ccafcf41101824943b92b3c1e23193e21","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1536167692060","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-MdQUcbftGZ2roJWqG2yK1WrgEu/uCDtzEt2CaxL6EdAfofEmVr+srepEu/2xl96MWuO6VQOhOry5jFvLT8gzuA==","shasum":"3012705ba2db4ef0a158605fab5029e97cbd9ff0","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1536167692060.tgz","fileCount":55,"unpackedSize":610046,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbkA8XCRA9TVsSAnZWagAA4nUP/3Kd3wI4fpEkhsUCwbQE\njRiFv5t2tziakognpjAmCZwyARkmIbIyYGxkLXxNuW8NT8cg7WmtZ9aF0UT+\nS9UCKjVJedMjhS3oQoGZCd4uDgLNdkXr/BojAgbdYVcXGPSLAY/bxsK08oae\nEgSalJfRYKnHrUBgqt+dKUx/cHGhWmiCeso1LYOCgXKPg9WgQItzOAC3DLeC\nVg3rC0O4gU/S+k6NCLgsCFAQJc3oLIORtCTNb1/ILNv6XF7XlYxxjWOT/H+X\n03MFotP79NVFmiC1/Gz6sz4w183jvZJJ6Q8QXg0urY1oKvOKOWe1PRNorMbp\n36P9/PjNbh2ZuB/H1ab8iR7SuCoKeCXb5S+DgZcUiWz9270zNLO2D/Emlp5V\nu4H/b9FVYotTHUgBC2AJxEJOJ+IwJFb/4uML9kRKAecQiOT/vILz49NS7CLs\nvsMKJhmliqly9fQvKuu8xxJnBTTk1gTMf4kbLJXVfuuYqpj6xAoMtlYJ83F1\nrZ1T+k4tZyIAud9dZmalhMeYiJCbJtOH35fAjf/u7Q4o4mbmVrDR2kdmLEl+\n5I6IRp2GBkD/yw/7xA+1dNZp3tvUJKEM85bNAosqQ0/cZ1tFbcSCuQVzBvq/\nj5fGuEjsqzYzz/cjk6WSf+j5wDV7zwx4/vuvB5pCnzDiDeesRXVTDq66NYoh\nITcU\r\n=QNy7\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1536167692060_1536167702637_0.7609828466643418"},"_hasShrinkwrap":false},"1.7.0-next.1536176172701":{"name":"puppeteer","version":"1.7.0-next.1536176172701","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"7db4f0f7985b039828830c79f4a5a8e7adbfed97","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1536176172701","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-L/CIVt3evPNZDmo/YJbPjB3lM7M1xsoKSntdBsspVVGJXCbGd5sklgMmGDA9TjO/5w+WjBK/xfpGc52QF772mQ==","shasum":"bd17e3056ae3300a42647e077873fd1ceb758434","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1536176172701.tgz","fileCount":55,"unpackedSize":610046,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbkDA3CRA9TVsSAnZWagAAN+UP/jpJfyEesTg8E+IEueld\nvtbNELk2V8ZEpUgkT4s6eYiZShXFBRdO2jmKuFUbLtoNNP7Gfm1u7mxkDlv/\nzjaRdsErxNKZPjRFN60QZNKHBV4eTjdEhAoOCoW4ZwQ70OQk3Wmd0VT5lrit\n7ylByUZ6ODX50H9Z3QN7vH4HQECB7vzKk94owIBGDx38bqSofKHvhU4IFc2c\n9qIsW7SwZt/hZPbc42Pl7JFkaGB/DxUNHE+m/30C0F8i8ciNYeHUNHBqhbjQ\nNAseJt7tCZGjDQw4whYEUcgY9rtxlW4aLEp95CaAqZSR3YQCzFA7Dklmq3r9\n4aaCA1ZRqR6PTXC31KM4B0zYipOgm7IOX+ICcc0lCTR3zTYpj5T4XvSjidt6\njFpewEIwAFnpnXVBDrxLhEkncsRd04FedWcbCgWiAL0A8eCHCC+SzPZl67XY\nd+qMLAJps8OPAMEyJF3ATpFAuiz4kQAdMah5dP2vE+3gV3QRxLem5ViF+M4u\ngpUg7Xzon3OLn/jCoFch9HxBcN5vaghSsh/tdoymp8fhveqL9ASr79f/W3Lu\nsUv+1vIw/MlMi0BwbWMbiJSVJ7nXyxYg7s8MHec1DiPp0sTviTnBQPiFPefX\niy5ojtEmu/Q3Q2NHtpwipqmihbHLylXZ7eqinGkC1LqfRj7VGHxR2Z9yDr66\nflb/\r\n=eNKi\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1536176172701_1536176182614_0.5425173350853449"},"_hasShrinkwrap":false},"1.7.0-next.1536177940806":{"name":"puppeteer","version":"1.7.0-next.1536177940806","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"84c2621dd4b6d30a4ebfa54a1e91203aa101968f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1536177940806","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-tFbIAuQ4pSiLjGEwRx6KTPThW9MFbNLdqUNo+qrxvFNKTsWnNbqfmcF8FDuKNhuVo1DgzpI3uzvroXSX4S721w==","shasum":"751196f5d9a980e7a91f0e602126055f7e1db1fd","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1536177940806.tgz","fileCount":55,"unpackedSize":608350,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbkDceCRA9TVsSAnZWagAAoXQQAKCL6ZyTZym1zIue2zp2\nRgZBRxoV5N2MfQ0D+zudYSIKlRG/hfCLLihHRlH7sqMpBGJu9/mTTajHqSDD\nBGXYY56vivmOhPwy5Xrne0TfUdcUwjsGGzIotUpVfTKGy7/x0M+DXZ9PVWos\n5YQee2nWGiqBAkvFhppQcYOz3+eMxh3sZlz4lauGULz0BydgCniAnCIGjuMB\ncKp5QfAL7eh/nADNIl5bvbxA05SRL08qIonNIgV6EBh1JdWt4JwaAGXrPakZ\n4Vy0Gzk2yLLErykpYHCqJdPiBkc9szp/Ce5NlDUD/RnB/ePsBw+jZeziIO+A\nMGJtstZzcCt02gcaQNTe+/QDCiexTrIbuXscywC97hXsyDto8TE7CPxhDVsx\n5e/1kd04127JEvUE+C4Rv0s5lGgLpqJEJ1IDQ8zJUQ5C0foaya9KsskpiGvL\nkpV2kxUZ62PNR36qbnIMsp1cJZk76sgPqzDa/wIEHvgVwIv/bsvHzJ+nkXpB\nFhIeIyji7FfUlNkgLVayFa8CmiJq/L7e5mJv5w4QCaLhHZ7wVyLoi9sNSmHu\nMtjC0TrZt2RqLIYReDiVXH+B3d4rjoenglVd4/WISnM3cUHfCJL1YxL6nNgN\nK2W+LSFvDqdZ0rb2rf4rqmUc5jrgNz3VgFmdXH0yS0xlBKD3+58t0j2Onbhe\nKG+U\r\n=8LSd\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1536177940806_1536177949940_0.6455532174435885"},"_hasShrinkwrap":false},"1.7.0-next.1536177984039":{"name":"puppeteer","version":"1.7.0-next.1536177984039","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"7f9e276733a7dea8ccc414147a637862884403c3","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1536177984039","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-DJx0j3PMVNK8IR/xtfCiug64yuxlNQ6hBNSlysyHZ4El3V+nxeYsdEI3lUEQ9/S8se1cgnavAwtbFdhnx5bs5g==","shasum":"8989cbd953031a885c3fb556daef6b82ffc91c51","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1536177984039.tgz","fileCount":55,"unpackedSize":608622,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbkDdKCRA9TVsSAnZWagAA20AP/jQT4oRV7R68JJThacV7\nLK3cPOVJqEnz/eEkDLwzA6cLen6r2PypHoSJHOxvx5N4h8zKB6TaSHMmU8R5\nm0jnspvKJc088UZnqHTHGY1t8smjkmKjjVXRp16LOfJBW3wTt5Fq3m2AODVv\nTxaOVIPAAheDOfSKJz+mVkOdj5o5v+DU5Cfgg3Y7mUbjxgs7gQM7pFOdhxsw\nYeIk0c/vkWWcpe9HQm78VirmBILg/M3LDKT2r1XauzP3nS9/Wi/NOshKxXKF\nnsbXhDCFMPpHYAsV1v0N8gExwKK7pSgRvpuSoE+XtKQYuOxsOI4q4MFFEMA/\n+/jw+9rIgZ18v9eFEmYPOz7xUqrzd4o86CDZ1Esq4FiiVxHbRwFoxdOO3z/P\n7mmqUZf5SNKO7OanpqoTgKxAbalyvviXO4jYU9A5UhIIpG/Gff4lv08kWlkB\n26FCVdX0iYJVsiBXVCw39LC+kJiY3OhEaAf6Bz5/5IyBY9EZUHbjfwXw4i88\nfMaRLqXfhszfI8QKZNKGvWw47RyQxWIft6I0p7N+jSNST8tx79kF+jc6kOtA\nTAPIlOBY3HuOnowGE0Dvlqjkkx4Tr3QajahVgjXrFc5PPgWp6V1sw5Da+y8E\n0bYM3eSdfsCq3NDn8eL2oS2YuJXq+lfWX+yzhtxh818FOT7KicGhVZTUH+pg\nXZQg\r\n=30vU\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1536177984039_1536177994023_0.33783268613662965"},"_hasShrinkwrap":false},"1.7.0-next.1536184951011":{"name":"puppeteer","version":"1.7.0-next.1536184951011","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"d54c7edeae44800dabb87e52ae96180a16a149a1","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1536184951011","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-kkZ2X+MWnKaN/A7IJNfzIK0Sx0E8lQ4mE0VKwpI8MJhoJSDaI5yS9XWFuRQU4hffTT72fJFHSPthSql/GeYVNQ==","shasum":"e1c56a04f346e2ca80b8b0e9533a059854d6f3b6","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1536184951011.tgz","fileCount":55,"unpackedSize":611904,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbkFKBCRA9TVsSAnZWagAA2Y4P/j6lxwjB4XbDgoUjiuea\nCiIs+NzL+o8AMeCRvUXSp8ewkK8e97u8OCzuVSkve3LjnzK9JTVjx3j2M/ZU\nL3U9xZfJVSjNXRZkoOFRoDIjNU/pYo6UyLNeUUn1GIz1R7cMVXGDWC9NmPi+\n6JB/5we7D8oj7ARksjX7YcC4lqKC83u2eUfFu+5aLurolZrRo51iXKyY2P8G\n1cgDNtsOYB4A+7XNWdf5RlMJ1Qq6+XUOFxnkDntaJshD9Fmkvxza9fAL/tfc\njKR4l/vOwPoxIcJN3RX36SToFnDBKoGfM0aJ2JudTDV5Tfib/isXeUDuMAts\nrXYw5jVqhQ/4glMmGPxLEKjj9CTOECJVkkVo9e+YgGcx+WRmB57erlwWcDNg\nIt8PfjFIwpq1tTa+jSES1paKdrRq99dfahrPykynz7stYnRYD9xNAsa7lHu+\nnVbCFeErQ3bKgbEoHsq/lF5mouS4NpnyhLc/oDtR1IsmZ2SmtVMvNfcRwNZ9\nduvJzlpyPvr9OKmNpPmdMa/NeZyfLcIiuSrz6Ktiaa3O4KQm00TLS5r6T/+m\n5VCO5ArZfkFBSWTarjur5t+cf02LPmzNDSeVLRj4Crq7wP3z5ZLs/Uj0Mnk8\n1j1LQE/bb8VklOS5gmfmSYi2vb5CeefH9y9+l2iJOPS3obsRLzkfKbP3e9iG\nJjkf\r\n=cKFX\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1536184951011_1536184960903_0.4290696669381282"},"_hasShrinkwrap":false},"1.7.0-next.1536184959160":{"name":"puppeteer","version":"1.7.0-next.1536184959160","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"28d92116b7072d43665c4e7b964e0e27167a9053","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1536184959160","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-B1fXUOBiazEUUxMUQxn5XuH9lbIZDaVmrzYoP0Yc+L9oER3HobsXhuQRI19BGOxIbgx1wOtjPr4TXoAZg5MEOA==","shasum":"fcb8c78eab92ca81354688c607ce3b573f28ca6a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1536184959160.tgz","fileCount":55,"unpackedSize":611112,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbkFKJCRA9TVsSAnZWagAAXP4P/2WOnpoRbH+KimIn5Kjt\nCLvh+8aoaQxsjw9V1Otx40CkJS0OrS8J1u2ukPqmhceBE48ttcikpZHiEmD6\nh8XEi8Oa51QAvoQR1EZIsR2GpUlN4hgxnd9faSJoIh8E+ysGcIyCy9JqmwqM\nZjdKh+WipOvTx6p6tVBjwFDtWBGys7f7tu7w1roLdfPNoxby7wjN0/VNX+7J\nimaaXN8NvFquiZFboYuuqUSadZNMZeUG6X9VRkCHprsg5gHi8ltVF7qiDKm2\nQsoakzmxewnpV20DgDRR4uUCpiq6LpTFQycGbfxZnBN0hjSxY8lb8RQo3A7N\nmbf7Y3OtbN62AZ41oUycA9K4JJY9JJxxVS1r51Hlnzv1OQCXph7zMlbUL6Vc\nK86IPbJA9ujoXfr9D4Sl5wnTPITe7PHBVTsn2vOTrhcIUNjNPZC+FlanpIwH\nEKAAjLiwlq60GwJU0fz9XfRmlkyEsueErF2BPMQGkznK/la9tEVKn9Uw9qwA\nJd1CqEmvtlhYZzPkZKtU7fwVfPwAugFHhGUwxViKHtNxRgmwqk+txzOMSstS\nJMRRAnKeq2+w32D9Jc+tZETXZWcaPQe7s3gAa2JnhTGipC2EtT0F+2syXINy\nkVar6I7/rv2k9pHXTy/CF33EldK842JiY64oRFG3u7OWKS6BrjEvHlXIQ1on\nJggD\r\n=Z+eS\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1536184959160_1536184968964_0.3154539786183741"},"_hasShrinkwrap":false},"1.7.0-next.1536262621679":{"name":"puppeteer","version":"1.7.0-next.1536262621679","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"f230722ff0e9d0a10913a74a00febfec522bcbee","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1536262621679","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-UCeH1URt9X5YOlNfDwlA4NcSxdCvhHlOSPBwjWQ09If5jCQtTc/VxAz5OEJxPhXSp0MAa6ZoNHWMqLRDsM06XQ==","shasum":"c093bc595c5a1b7714a40086e287552fcc4f3946","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1536262621679.tgz","fileCount":55,"unpackedSize":612476,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbkYHnCRA9TVsSAnZWagAAkQoP/05H5L8zuAmaMHn+MlZJ\nmEoFZUnnxf3W79iG9fmWg9ozheLif8OUltvOVUx4kfxB4w1X/8Y/nnyyxJub\nH5LANxYVzqakq0u1y0Z54YCliO+3UNI6XsmlDyFwup3d7dVyptHiOH6ek4JG\neEBtp+N/vkpNXYeNJY3jlQVN2ct3nC0vj08AyprhCwgTIYS/Os5lV52EhToV\n6a9xuwhbl2B4F/9ccnpmDzwgXbbZ/14wADvrR1Qjf7JC4Qu/ddPwrcQfMoM2\nFqVw4eBXs1tJT01ZSJZ+TEcxEbRG+aSjN0NBizTn6hrHwEHn9xUCkBSYZ+s7\nJ6vNPhmWlGHJA3rX2ItGLWWa3eWVtDKnHadpDayuHpCSsgDHuTCNSKKrVq+2\nSSHB6Btou9b3v29TRtN5oa6CKt6Jy8+xBaD/Ln4eflMGxVF95dUuin7xUr25\nlj653cHm1LGsxz8xYYu9a9c0ceSMz1cUT4pTB1KrqEAd+atgGo2VjXFGmrid\nJvmC71SyTNqBXSD1D5HZPw/xEWVN+qe85uJO6jAa0jSXfa16ozeUzcuywoTN\ndqzIiNhFspkwcXPHausf1BaOj4dOHmzBAVh9zJZIr0P1Jh4vjCKIqika9B75\n2fK0Xngc2BsJqrT1uJOc2+ySJ6roe3b2sfgPai8QTGP/Km4nOgY+B0bTSLk4\nvjid\r\n=9Y3f\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1536262621679_1536262630739_0.5009199298350362"},"_hasShrinkwrap":false},"1.7.0-next.1536266490601":{"name":"puppeteer","version":"1.7.0-next.1536266490601","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"42fde9b5e2f9d08c8a134a09c240fb1b531bc771","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.7.0-next.1536266490601","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-ayLUWeYs1OoeJ8Mxytjcd+7AtRLdRTainXsRct/wRQCZbL6dN7jx+TnGlTMfY8gfCW3+DYeIQZTTxRdFHERy2w==","shasum":"5d5407289ca615d80193d4fd1b2898902b13ab3e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.7.0-next.1536266490601.tgz","fileCount":55,"unpackedSize":612476,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbkZEFCRA9TVsSAnZWagAAzvYP/RRFrnBha+q7/kJr436c\n16W0OSWFvCzEhl02QtP0/q+sOPr7SXcj29XtoDkwMxmDfjSRayByYZHz6Kiv\nTUco5n4zxSCHTSRFdMHBME/a4FAHqwKNA2ugjJVa5bPIflpQ4Gt4vqfwlw5O\nPbJTpng41mlOKcAjGZ9NJrtTGf0HK0qPuP40Ks6A5tP05/jjOD9AkFa7iZnR\nHG4f6W/NDs+EB+ezQ1+4jDcoX9WH6+teINwCEd4B1v8N09pQy/M1UX8HRKmn\nOAt+o2jW4R/71AxDiCbi21uzsql1A/gNfAgbycIiFJX+snhLPo1HdC9cU09r\nyr8VSpbtJPuDlsTR82wTSDjoc2mfR6+5JJUt7U2symvXm9ZtJwGse7peuKsN\nyFDP6bdw5cPQbHT3Ny9dJDi8eHO3MD+sQK4G5MOd+6v1XJoTjkMZ+rZw0Zme\nYvrxfQX9JoYb9KoXLu6pGuqnD1LMkNHx1Qu49LQT+8HM1YvYqNh7nJ1wL+Q5\n/vmN8SbFWf7oh2p9XNahfOByK4QWvf/CmuaJwnKOKt5KRYLy1MB3iASecoGV\nyBaJDHRNe72gOM9C22IKF80tjtI1Gn8Wpo+pGUjBY+q0V//Qyjx8qY89CQjb\nPw94Rk6lnZrk/cVzyLkX96WqJjgm37NS7q3FxNPdDw1K5Xnv+f+kt1Cw4+jN\nTjjf\r\n=sL13\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.7.0-next.1536266490601_1536266501036_0.7697608831207599"},"_hasShrinkwrap":false},"1.8.0-next.1536267134761":{"name":"puppeteer","version":"1.8.0-next.1536267134761","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"aeb6a9991e01a82153f803c727abf8d56fb072c6","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1536267134761","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-Uu3dMsiM3Jkh8061fjPLk5Rn8zszwzcvtlVL0pfcAPmGM5s0DcT6QsjDqmD8mMSf62wjwGyAwqNtzEa0gfgxpw==","shasum":"192451ccc8ca2b99c01c6b1a531803d370a2cb82","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1536267134761.tgz","fileCount":55,"unpackedSize":612476,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbkZOLCRA9TVsSAnZWagAAPp8QAKTJ5J1in+omBPcecC5l\ncRgHdfobbi59lzh5Ps4mRCstYPc+F1GGrsuIL3CGLakZ3oEpiosperR9W/x6\ndM9VtS9jCPlVX5QoXY8XrjdOjsNmZHhr0Jt6LH+Ax+g5hCNKLESk7A3OmzGg\n1meBxRuKdxQGd6fc+bl2uPwFcxWzA5OyX4kroUMKPXMmlBz73XvXvnNdrte9\nDouGAoqg5EvFvnTWFJkQsJNlaEx9wiIkVtVkf2sWGb+OH8WKKR0304GvLD7T\ndskgNy956BVHS/oBkPW7lJZelnKSKnIKTz5r4VO/Fcl+A6PmIppDcWPIkkTN\nIfgGsz3u0RYlw79eoBJ2bKHk7jO/2jzwXTpOo/2G7GU7MunwNuI9OrtfAUdK\nAHLYljNBuMZQHG3MSiP8APAjmEvElwXeNmzbR7n3LP/b5cELNVsGX84yTqmf\ncLq4jeVcQXNk3c4OxwWepnAUD7QLLAzRad3nIoiAU87/BEciBKY2P0muUGgL\n/CpvQ6ZrDE6Z19TcA1znAbP2WPjVCsk8vCzN+app7jDdCptdRCWQ3IUiFays\nzdQtEl2Gj6BZDHbg/B9J2r1Ly3H2PU7M36khCqlldf9Hbo7lNOkOdjoE5WNk\n2+YjQaUG0s8mK3t0EDDqJwDFjyuikWDDX18zJmB0CnNtjD5x4bq9IpO33S2P\nntuo\r\n=2CVV\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1536267134761_1536267146483_0.011569375369285817"},"_hasShrinkwrap":false},"1.8.0":{"name":"puppeteer","version":"1.8.0","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"aeb6a9991e01a82153f803c727abf8d56fb072c6","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0","_npmVersion":"5.6.0","_nodeVersion":"10.2.1","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-wJ7Fxs03l4dy/ZXQACUKBBobIuJaS4NHq44q7/QinpAXFMwJMJFEIPjzoksVzUhZxQe+RXnjXH69mg13yMh0BA==","shasum":"9e8bbd2f5448cc19cac220efc0512837104877ad","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0.tgz","fileCount":55,"unpackedSize":612457,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbkZQ+CRA9TVsSAnZWagAAJJkP/jMnkYfjf7r+AYI8YyRU\nKNgni31tlc5XrcRSuAJ8kjiw63pf6QI8dED0iim148/61V6UWHVJOL2R/eJu\ngtqh1h8HB8eDvlguLRkbcakG42pzU7n/cTMVQecJm3Rz3DpLf+fJFYexBlmr\n2ESPYqpVfm9fcUXMP9MGzb2xdzwSVH96aLQLpnxEQrZrgr8EVr7KbLsjnwMJ\nYeNAKFZyq7iEH0ZPspBaQ+ZxIUX9X12Q1KPiZohT1xjCFrFGx3vDChH23pon\nxVBr5u9NUBGtLdOU/TXCT24MuVSEqEPYWBUy5+cMA75rWnUWDHuk8Bl1uZAO\nAo9PWEBjivWESc5bfiC9B9bc2WSs8/31UdobOlb0JyR9h1g9lbAP0QIare9e\nbZ8gE6iX4BJDWNZZGLn9epSf2Ey4Z7V7zOQqhQHlZi9ZpcE1iqL13XLIwtS4\nGK2wNiSga2GMIlN8BFOQh761ObL/Z89dCOApwRHWLIECHewxKj7BQ2gRDxd3\nhzWgFQP59cEvGpS3Fx5DI4QsR6z9oOf034h4kDc8/Y/8LtCn9kiaMBmygP79\nO16pdypBFkCHLFnf4rOsEvcoPsXaur1q2bqgGyNJIicxHtrdXwAvz6q/Vp+q\n8InwuU2uhBGTtDx4J/qs3P84CVicv0fYa/AobGUoRAH5keUa6hacw6z35jZ4\n9+rt\r\n=rkxX\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0_1536267326096_0.6263692028766783"},"_hasShrinkwrap":false},"1.8.0-next.1536267991002":{"name":"puppeteer","version":"1.8.0-next.1536267991002","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"78e9d5c422bc74403fb22191484a68c9b579c362","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1536267991002","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-eKPE21mejMNLEQEE7PYzmQgGuC+OnWjnXAZ/U3LNmwqytVmOooLI3wbyutiGpgh29bcxddVKgg7RuKCPBELHuA==","shasum":"efc5d30cfc40f4aad5705072fe740d7d25fce342","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1536267991002.tgz","fileCount":55,"unpackedSize":612476,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbkZbiCRA9TVsSAnZWagAAwwMP/i4GGi1or5pK78w0SwBJ\nAkvaPh+/hBCk+eVgJqVDfbdyaB7MdWoVEeWJqypH23NlyxYQ/24v7WeQQ3d2\n1GADrWYDCzgnNrQG8AA2vltlLWD0/3L0Ynxz8Io5galAMwrvcxqfSHu6/eBc\ntxHxGgVqOzfBqV3h/FZaaxN3FH3UGwTEkidHY/EnUxjSGjHjEbFuwn+RQtOv\nAmCZi0h2/LEp7TAUd5ctONLyff7wUI4e91pmtokcoJrTCvOP/fsoLTyv/vqq\nQ6BVXjZIeq9dYN6XpAJq9LIgE2PQvoZYUyLytZVogCQDarjLFf/HWuOyS1k4\nFNDjIYRcZdUAyKozUPWwrO2pOaQWGBA6OYATXjHxVlpeO8C8Uo345dltRmXs\nkiTUGRGUjrxeJSVKGGv15+1fhiVlaOz8VFp/zsbDbsUIme6ZLDBpyWX4ogeX\nJ4beGlacPEVSTl9cK8zmqxwupeZsTLSAi9Rq37yR+amzvaGdR1YG9iRe3TQg\nhGjtJHxa5F2G+NIdU8WzpENrM5RZWBAGVYawK3YtQcECnNLBq+oe/2XlOU7J\nteeJCGBOncVNqbFsN+VzXIaJ7D+HU2aziKRXSH3SVUBV18hJKWDTJUioE32v\n4RyEjppgrAjPwiK/CMSQkg7s4a10HZETEpCL9Myx97z0BBurhz1yTsKazAdZ\nsjQV\r\n=Aa4j\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1536267991002_1536268001520_0.9967591613506452"},"_hasShrinkwrap":false},"1.8.0-next.1536313779891":{"name":"puppeteer","version":"1.8.0-next.1536313779891","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"c967aebc8404a6747f1b9dc67f439594c5b09e2c","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1536313779891","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-yFpUqcRGSLZbqJgQr+Fjkres9Xa0n8osjD4ZU5nNSVS+WvcfCUPcDaJsRit9CtmTvRPY4+CSz3/I5XtxfR8R3Q==","shasum":"798f72ba4fb2bc7eeb4e4be0b6b5b72852275dc0","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1536313779891.tgz","fileCount":55,"unpackedSize":612476,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbkkm/CRA9TVsSAnZWagAACkYP/3P5wAvGBOBNw+ISWdzZ\nf+dZ7IgrABdpbgYIoSVEAQk8I7JmzysC8K8qzz1F0imkQA8ncLVTZAZf42l8\nAEMz6mY2tFOaqNxYgLh/OQDe301yDRbf/clYylWvxwsIzwwqK3OxrpRgSNo3\nw11iipt2tvi83Wpile6rfgF6ixamxW85JztX/ZkVtTK3MpMWEBUP+fiHec7z\nI9IUvzObCCwOQmeIj9IItO8saCMEl3HeH4rf9sgwqE0THo+t6drcPnde3RFV\ncplI4rssl9YKdfPBxlMEx6Xb0yechwp3HFAo/QWP7N6tSNbsRNtLcHrCzJOd\nlavn9Pw+LhWXo24fDnCBV2Text7fV/MRQT1FndR2f44LKOAlbzLqLUUp4C9n\neEZ6/fXYjE/nVPvfJm9e9OKf7lftkxdfbA8mTCHKlU+6N0vgUa9jSgkfd5hm\nOmrq2bvH9qsTsAuFwXbeZfOub0MFVjjalbfVYfU+D2IJYjFacqFbz2SUa6fU\n34W4rs7SllEbjGAw/ntNZ6Az4hv8aR6lBE4np/BgbDziBpoURxnP7zbwQHl4\nx4aRg827CSLlWIhiMxiX1OOZeVAwbyZQP9D9a05FUkc/7EX3eDlImDE4tATc\nROp8lMFfto0+h707AmxC01zXT5KcEZoMpGDzkAD84QcEQJqmWDQ68gWXTL+x\nqNMp\r\n=eOXZ\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1536313779891_1536313790200_0.7228730753493202"},"_hasShrinkwrap":false},"1.8.0-next.1536352705819":{"name":"puppeteer","version":"1.8.0-next.1536352705819","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"1b2c8113ba39899ee52e670c035cf009ea35bd93","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1536352705819","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-5fzw5pLPoiyeMk+2pywTzbLb8U9yZN6BxlBlSKLOCA4LXGv4LI4gu8AMYhv/UVHn0mU2CFxsUC05Thl6H7Bhgw==","shasum":"438fcb67b00e46e47152c6d476caead884ae68b3","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1536352705819.tgz","fileCount":57,"unpackedSize":614368,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbkuHMCRA9TVsSAnZWagAAdAAP/jVdHsLsxGd2UiQt9/YH\nkPbsdYeYtPvhxZSP8WdC5Wl7AgxBdVfCN+hLXFsbIeT9eqH4RkE2HXpdbWKy\nGm9mGCWm08OKfXnKJM2v9JgQ3hlzI6QrMcWO6n6f6lVQ+PI+zMq39RmvDcRI\nGU26CZBnNzd8PnQjKkAkmdmHfYCb9nNelk/Syx5ha30OS15aToSFVUYF0VCv\nOITRQfOG++IS3VyHCtWRxqi5maJD+rAKIzkpL3FnQ8kHZoqP8pcjzR0MNVj6\n/D/5XyKb7vn4L1yTBvyoxOtto/r/R8sBvcTt1P2ilrEo0LRpbbjhTyQJ1EZZ\nZVlEEW958KbfltTG3HDaxAEJgljWrAF8lBCgxq9rJUSP00Mers5VbH3L9AUq\nWZsVOcVfPi0nM10T0tjgh4v8vbOeI9beQCcEgYDTDcICNmiseLAZ3Jg4JH43\nt3Vhm5nO5sEoi+ge39Qksu7dLmjONyKMbhNXueHOR0SgWLsCpUKFXcrBVD4k\n8pgY9K3kmgodSRi3KXQ7oXFZw2giZ5Rs64OqEMkNRi00B5z7rviVAgDY4+ml\nD4+uylUrUPAwaskSi34T6R7/uIpwFTqIzxLYtfaoZan/NqBsr+z1U9eyI314\ntGzk7NMYFvxust96H8vRyM6vr+rbQl2jdB2yy5QQD6FkNIa3iFIZvyLyxPCz\nlGgs\r\n=owqf\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1536352705819_1536352715717_0.3025305683221413"},"_hasShrinkwrap":false},"1.8.0-next.1536404184361":{"name":"puppeteer","version":"1.8.0-next.1536404184361","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"6581ee974c6919a589f0ab5b9eab036b13bb0c22","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1536404184361","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-XUPosL8E1foY1c6kqUdo7KYQWeub7wkeWP6wOsuBAq+F9zAHs6kMNwwwIlSvHrtd71Gv0u67opg+MDrXOIs20Q==","shasum":"2c822388e94b6411dcc9f0c669fdc171bb3f5256","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1536404184361.tgz","fileCount":57,"unpackedSize":614793,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbk6riCRA9TVsSAnZWagAAK1MP/2weg/yrPHPewG41NH75\nslgWjD5KN/zrkMsLZ7+LQXW2Mgeds4Rc5lkKr3vIKQ9f3i8pQgvz8bveQHFV\nYLEe4U8Te5Zgjh3BrKT2szXdNQWdgV3Jvp8FqBhYFPcPkwoFR5j7P7t1f53/\nTfH9iTUCeAjyIpMw5OHyrqzLDoRAQ3T0r1Cqu2WgIUT5mhSYsMFmmXWr0N2J\nCJY0BVLxq0hX0ugBjIjYZopGYYP1s7g6cu5m/3zcmX7/F40l+ViWbJwzX9uj\nKkg596ppGvBn4GHDq4nSECjfjZYnCGNlNw3ba66OQePw/L4wZHvW93ZXWtKC\ng2Ns+FHOgPACHy/Ayi/89coyYvhTXidJnnZejWIrQ5w62KaxTKADrp5k2w3C\nYDgK73+vSOY2YAW8P5votrAUfZXmNTkWyz5Hsh9VVTanqSca/XKsUzXmeypq\nxKgm5cQwlFRRjY5fCr5/ip2b7DjV8iHITQAwmLekJu6qZQ1jMfNPUoTUlm5Y\nucRjsKn7v2yUxbGvSiG19pYJamcHsztUg2cQNZIWpGZ9y35gu/Pygn/pJ0YJ\nbl+cwnMtrW/o4jlHNRIkdPqcRImWp0PwdE6DtpSs3KVqvOIYfkB9PLURvKDJ\nn2k6HMLimj7YEg0XkSINqxOFKJmXUgA0jygTyNl6vz2m2gKfjgKziFWYVpYI\n+F+V\r\n=1xVn\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1536404184361_1536404193403_0.23186687189308963"},"_hasShrinkwrap":false},"1.8.0-next.1536664892181":{"name":"puppeteer","version":"1.8.0-next.1536664892181","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"56b3bd809e6e600dcaf3c4dcbe5d4b47f45ba8a5","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1536664892181","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-kEONr3n+2iuwnVbLI6NrjR3hYvkK+W0LpEdPFMOmk1tApuP+TDjkF4bbdE8+5C5N5d4U2Qavcuz0E1a6jsOHQg==","shasum":"0adb528e4f383ec86389a5d3ee07a524ffebfe8a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1536664892181.tgz","fileCount":57,"unpackedSize":614824,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbl6VHCRA9TVsSAnZWagAAbmAP+QBlLhMDSS+rZAeanaHv\nvrCodFfK64gzXJRLMg/9sG5W2XA6/wKdSTd9PCE0NYElNMR2aML+IEIUNwqb\nfuoQwET28zBdxF8B8df0Uvqm0mejAxntoUpdXItvHpQOejS8IGvjYAbs+WVX\nLVCh1JIwBB1LfXqK3IMat/Tl4e+RQAa7L1qwOcVqu8sd6t3vvy0PF/YpSxOe\nWnXrMvRpzoun9b/MYubUk+2QK84ULSXYYSiNQtkxOH3yxIGp5tF/sTTTMyeE\nXLFRFRSvedp4Z5tdpuLLmkyHK58F9irlp3e2FzLiXnWI16FCdEEL1w6W1MTZ\nS3f6XkMLqGVt8HJYdTgQRNWL0nq03m+w8/+/dxgNNaPzFerIrRaCq2aUsOqN\nU/CofR+qJwXmHNqXBmEKWPD8gb1qfmqe6QCXWzShFPEw49LRxhMLtlBL874m\nGxKl1U7PeK7Ei6u8K2oTIRZPou2fT2CS878o1gzacke5SbArDSbicZeGTm2y\nEVGGuqLkGyL2iy85wf2/q/IGrcfs6jOIqKGRU0hpdni8+Dvpx7DrC8w7Rf7K\nXtiubyzVdToKQovfhgi899ELT1PCw/vusnGXwYYQ3IunA/AWyH3y0m/ESaaF\n90+ZAhrkphCAgr7uYH1s86qEr6Eemu9al0OAvjufPalVkmiqQuyuUJR4stRk\nbuJS\r\n=aOvq\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1536664892181_1536664902597_0.21326358364202047"},"_hasShrinkwrap":false},"1.8.0-next.1536687830102":{"name":"puppeteer","version":"1.8.0-next.1536687830102","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"9c4b6d06e214946e38999b9325c7d10152a1cf69","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1536687830102","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-Dh0WxNnHhrEZYA3MQadeT+t98Gh16TfBXk/gRt2IPQIQiFD2naSXKCYhofwgP7wsfQTYgqQbRGoGw7EjCjkUiA==","shasum":"a04d96d04f114e60dec97feb9e6e2b215584850d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1536687830102.tgz","fileCount":57,"unpackedSize":614982,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbl/7iCRA9TVsSAnZWagAAVyYP+wRe5BD7bvrx7PKj+jpD\nRSu0NIJB1gWfJOw4dTE+vL8mqi3bnHDRmOZv7MyaUoo+69niSZrs1aReDG6Q\npGoB27gGmDpL9mirq+leLaj0wRRcapzSRLZd0yLpZdisQMVIW3+OIIkOeRu0\nOFpUQMub1WNLEJaHknJukcDc0aba7XkiXrJC5CDtb81CbIx4mukkJRybS7p/\n9Z7DPED/pmYq9g94ARdZKtE7WzWNzG6aM4RlIFYe6VR6W+nAfMXUpzB0nuLp\nAuYt9mDB0PHC9ry34wyOZG6TmNcjBGY8PNAvg5/DmN01ogUzPkBQTRQxw7Tn\ndGJm3mY3ZJIIMXeeCLKrlyiT3W918OXUN8makdcQoz2EDn1pQXQ6hIwX5CLW\nV6IZ8uQghQo/Mibprk+Obt2T6yY4ZaJqjHxnLQXFgzpdiycOUNXufRTfDfc/\nlY2QWSOePtpAxM0cX/fEXO7CVvGEjS7kDBkrDBpbIkZDUj9TQXFWpZfbreYS\n/IH88zelrUeOtNAVRwcdFzM8chwqIPykwRp04Si1xQk6WcqLPuLs3LGB/Av+\nFN8pdN+5Tc0WQRktNQ6m/oCNGB0v/1/Gi/hXZgLojSe5K+QkHl4Loc+1FyZW\nYkR4eDU/wUbyGIaGqD0IcyZYQyK9WjQQ17XOl3wpQZuN8LJ19+uq5PmFHamt\ns8kl\r\n=qwjd\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1536687830102_1536687841473_0.015056110397006162"},"_hasShrinkwrap":false},"1.8.0-next.1536689410489":{"name":"puppeteer","version":"1.8.0-next.1536689410489","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"c644a3bbd3ee9722705a5a672a09828b9b90651b","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1536689410489","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-H9UbOzmWacyumBhZtnZ8eVjtN3QdSQ/PWnD3xaQZGFYFe1dowFeY2bREvmRRpBpbX5Hykmweq3NGMVHnXw7RTQ==","shasum":"0693d8decbbfdeb4f08178ad2bb7241c918406aa","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1536689410489.tgz","fileCount":57,"unpackedSize":614982,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbmAUNCRA9TVsSAnZWagAA+o4P/0crIR7MGx/lCZsKOm7D\ne8N3H8AqnsDgJ7yTjsoYVR29spJGeop4qHQfk3iySy66N7diY5WNV40rBOYD\n4v3v5JBdZscD3Blie+2g4aJtI8lTcH9fl4TykM5cizUf1kslNMktajtJAFeQ\nySGzSYsRavL1TOyBKNKcINred8fE6eRVh8XNn1pkviy95Z//UR/Eg1o6Bytr\nSOsjCyLSqzuY4ieNEgU1gggytDdhulTah6KIQS9sur1QVn6KmRprR4++Ilo4\nTe+KlQneU9yB5xw3BdiwilwyiYfdFwrnXGV7PFarcHqlwZxNq3J0lu6FHRHv\nKR9EqCScP4caXeC11bAYRiiQ+oSvC71HfISOC6Eg77zvgmjVss5x+CAl4z15\nZG/ms3rHJrLDOuFk+e2ivbgnHSwefg9FxuEKglj4VfY/5H3/Q8SSHI2a3j57\nw0FI2Cn/ee3ZHK6W+w9/ItlhQKZ3j4xXyzwxu4PtV7KJvlAHujiv1lU+aMbO\nh5Tv7WCUQRvqx+dwOrBNFMavqnWCI7nKvhVjCTTkzyPFzAWAAay+cC+OZrIX\nLJeM2AS9FdhtxiPtBNnlQTKIe/9lR3e0p3QhIoA/b5IJTRt3utPiAb+Pv4QZ\ni5z5GZgxL/gt1/OOhj7cORSPzwCgIB4aBIji7pQX26gJaASNtpUlNdzaDqIF\nM9Qo\r\n=ErNe\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1536689410489_1536689420959_0.5361917973516284"},"_hasShrinkwrap":false},"1.8.0-next.1536786749184":{"name":"puppeteer","version":"1.8.0-next.1536786749184","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"588429"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"7ec08017292e9346592620a768182bc4315807bf","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1536786749184","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-Vw5Yxd/fFdCb7D+zoGnUWCLAWPdRUzbDgchFyNFIdaNoTUa98JRAn1GSwmep4edqvW7ARcXeDBYGQL4bPJkeUg==","shasum":"60222ec4dd3df3fff2dd1297b187371e35fff020","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1536786749184.tgz","fileCount":57,"unpackedSize":615308,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbmYFLCRA9TVsSAnZWagAAaRgP/RqIJY5fImUWg9Bku9uM\nwCAs7DkwZKMat4BcE4x2GLfNaplvMiameSTm0ZoIFHGDoXLOvFKsBAYj+rr7\n8Ui9vtAXpGC5POBeHMmA1rWFs6bPAlVi/vyJEr0WWL2X28ET9yWo6CVFm3Ws\nGjDGLU0+cPQ5cpDcDZS3l7ma2AFFBMAwO+tOXEFuYB4pL2CL26Oj1z73M1da\nl1hWql93RAFblKikfujBKaznjg0W8vB1bsw3uoB1/2SwSqKA9FOPXMVlBSmx\n9y5gpQCl69wiceQYLmP+buwT+0/bhGSs1rGGitnNyKv26rIgHVOKAu6VFTWE\n1aqMTbbRhqrQHVdtL2PKu7jm2ht/XY5gpmOMOoPnY2DR1KrA2ZZ/fybQtIOo\n37CzIM4EXhtDvk4JbQCZb0yuEItkIQw5EdXVfQVOGKuuVVdXDW78r5ULBQXH\nksY6+jHLxt7IN5GIqEcEPmendrokwWBAAeu52AnSZh8KlVDqiTzwIql9zFAk\n4x7ydBZeXfwJWUYkeY+q7NcSkxXaUIU0SaO15nutROcjIxVpHw3wspdc9WE+\nWtPIHRmUOcAOYHryksW+E0gLnoyVQb4QTrxQmnNrFUWvP6khktmWgUz8Pm9g\novDka/oKSCa57ECRaCgU85Xf3jOWcgBvT6I81MNrIdLhMF01ku1CSI3jsThw\n9ZfC\r\n=Yzc+\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1536786749184_1536786762605_0.5769239393671379"},"_hasShrinkwrap":false},"1.8.0-next.1536862670912":{"name":"puppeteer","version":"1.8.0-next.1536862670912","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"590951"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"a582acd682812bda2863e25196b7c3f6cedac2e1","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1536862670912","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-/fMdsjgmB2x8cyXV73oHwJoM+PKulaz2kv0kY7m8smGqx0C+rh8VazTWjIZJZOf8QY1yoxyIQOEvMlbNLIRD+Q==","shasum":"83fbb1766623b24bfef1261f7e2c917f14a955ac","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1536862670912.tgz","fileCount":57,"unpackedSize":615308,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbmqndCRA9TVsSAnZWagAAj84QAIp9bS2IFd+XDX6gV2jz\ndWj/57lwbMn/mmudvYaVFt+daIDki8VXnEXgBozgH91GFm5mC69q2DLCbkCU\nsP3RrdO+LlLoEtURm04pqy9bH9GbaYqF7bR1lti4W8kuY+QRkMyZbNFPNGoX\nZizYpBgxKQmzZIRphqQtfbkC34vmQM5QZhbpm50CjMxQhcDJ5DHIW1ECdnTd\nlRAGAE6Yk9Ryx6dikv+Fea7h1lEcWbpd2ZI20gjRAJkK7+VICc6EmzzLrdb9\n0Qg4PMtMHJ4F1psmL+0BGuT+I61boxU/E4yEDPrDTvBos4NBBmg9vGItJb20\nU9SgedCzb00nSyXFKShBmMYX/zV5cyjNGjkv0nz1zNXq/qIP62V7txJAEOer\n9Wx4tn94ZDv+scBX+QjIJhtwF17wP2d5oBJ1tufLaxbbODkN27ZP4a0OLw+u\nkeEgjo7rsYB4p/1s/d+82x5Hixe3ShT3Gqft1PYNdhjdv/uzeHC5qPNEr1Oj\nK/m5x07x3IO09Uivk997tKdGjx6Els3x5BFlb+NLfq66Gvwfaa1KEaUjXa3g\nQF7xGKV5XUP2SALsLv6CVz+yoFhf/79zbhATsje0jm+itXjghcC9pMI2zEqU\nOCW51uClzDxi9OzLVTzqfZ0BNpbNh5yHpUk1oXAvxIbZe2yVZ5NFPTv+XJqT\nCBj8\r\n=8noK\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1536862670912_1536862684537_0.6603036981743664"},"_hasShrinkwrap":false},"1.8.0-next.1536863348198":{"name":"puppeteer","version":"1.8.0-next.1536863348198","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"590951"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"gitHead":"f49687f747f3467bce2608ea0421eaa099a8081e","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1536863348198","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-tFX3AZfE3EUEUun6kX6vMjVakVT3bU1L9vIf+Dfq8paoNi/MXx3GkzRbP35GEcyPW0FR6qckxWjAyquasJkbCw==","shasum":"27945f8ac2a848ff2bb9c974ac8383a8c398f931","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1536863348198.tgz","fileCount":57,"unpackedSize":615308,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbmqyCCRA9TVsSAnZWagAAZQoP/34IJKWob9mU8IjzyoBk\nTpk0ZaqfMC1z1qnbpsvp3rxXrdRVKE4zfocUqI5IWwfvQhC4vN9lbSpNCWmc\nMrNwm61erTRfMIXGYUSdkr5I/tigF3LRlErw+M0Y9Odx91ZScAb6UYSj28yO\nAoUsROKa+pFiD40N7TqSvzN/p68LvLp7HZPfNnRvPgyGw191PvgFOdCXqT7s\nFOpIQiAuy9hhk1T7O/7nDoNvOQw9T0vasTwnE3+xIqUpL0/jWwM0mr9v8Rbz\nob+oWb6nBTF6il3t6lqdBnro0pdydw70CtpEUbfT2RoKKcoYUzlrg74ZOVSj\nzjY/BIi2aQqTeFR0StIFB3cwHYZ0onayOLVvwpx6kWaJMvYc+WquymCeE4ap\nczpyezZUpKGppQAaGPSRaLziuZPrvvw6IldHc6wWxI98vQZF4rEf5/A21QnG\nl2ZPRgY6HY0luaRR5FzR6QMgTjUMQ86pJ0oAWn884FoGSdR2ncRFOwpglLLA\nMk66b0wMcZ9yY/qD6BhbpAbJZuWAwepCYqHTWnO1H0fZ1ANQPQhlD3TRXO+O\nZREq2PsEYMjAC1cuv6myFG5ewzkc08grkzNYqlv+RAyMEPaWXjewHaK9/wOr\nkHKXOD7XiD4yC28QUMm4R11V5txjx4pT719KdxLDILAAQPz4dQ3akz9Fk9ZQ\nM++v\r\n=BDgc\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1536863348198_1536863361742_0.2092269828094111"},"_hasShrinkwrap":false},"1.8.0-next.1536865920560":{"name":"puppeteer","version":"1.8.0-next.1536865920560","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"590951"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"6ec3ce6920095ea3c660ddf91567fb6dbe1714ef","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1536865920560","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-jMtc7M0O1pFa7JY6il88M22RnFCpegiAX2i1A4nJuLsq0FBP6z/yiqOpIp12cPFhjbIZx+X7YxBlFwDjTBz3PQ==","shasum":"e9324cb031b80d7510816948d5c08ab2fccf81eb","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1536865920560.tgz","fileCount":57,"unpackedSize":615668,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbmraPCRA9TVsSAnZWagAAwY4P/3Q1DXWOyLVoqtlY68uA\nRsBjwsLbPTc8vm0ptNl+LQIjX5/sFIkI+5hwHCtaRyFv4ZQyBid2LonosNLq\nbpXNc5Mm018nB/EMPopeX9CNH8BpExhIZjv6NSSxtrbBKeZrcpJoXlGQ/1OV\n9vahe0WR1OLukHhraMKZIJyq71WsAMrQc2xeetPEpUb/e0fO8Zl2d3ZJQNkc\n4YODGmZn6VgT114Akg/gxNb7N7D589jPa4t5fvXeFDE+yfxOADzAaZlsoZjW\nXBhBUVj7VPGr0GwDcNiyps9W7maW5266NAy+ARYd6snEmSU6gljGZ5OiHRic\nACqNIhNIUEoE3Km2Wix7PxH+ugLF8L6pMU7KfhR5j28/Ou+bWEUWb8wFUUux\n75ASdhb8u7TjdtFuy4xoG0y8GYq9uteNY4Gtsk2MFrhF1muBrTTaEhNJuIn3\nQ/TuKhdOrxGDMfEcP34lq7c3DnCpyyKvZfnLoLUePYqIgeC4WU66BaQkVugk\ngeNW1/3ZOQpPNovwJLwuMingN6/t513u6SBrkpMqVVtOmvAegDNRIAbME3uS\naVlLECRRqj8GyYfSuJ89JWZDhcflijrSqHoSMZd7J4im40nZ3NckRUkaHVr3\nMQ0KhQtViL6kG1yDSaDzM9dG0Ry3SSc9jnLa8RPFwXeuJlgwMgKX6ST+c136\nk7RY\r\n=RpnU\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1536865920560_1536865934888_0.5071838559408643"},"_hasShrinkwrap":false},"1.8.0-next.1536919640452":{"name":"puppeteer","version":"1.8.0-next.1536919640452","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"590951"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"d929f7e2137d2df6c1aa6d61e567f5e0fc0a578c","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - All public API calls and internal protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:*,-puppeteer:protocol\" node script.js # everything BUT protocol messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n env DEBUG=\"puppeteer:mouse,puppeteer:keyboard\" node script.js # only Mouse and Keyboard API calls\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:*\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1536919640452","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-Rj/uksDF+rQd27ud11GjH1xPRQlzVWccc93tMc0c6y/NZ1avUR27Xn0lUol3v9GXEt9k0NjbMQXshJvQkjFREg==","shasum":"a984ec139009762e1909d008051de88799e328a8","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1536919640452.tgz","fileCount":57,"unpackedSize":615873,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbm4hlCRA9TVsSAnZWagAAJDoP/RROXaSj4Amm+BYoscJT\nYoBdw7Gy6MVwXqEzfqdL6oE+iG1UgFi2133aqbef0ddnhdg+CxtuAapByzS+\n7H7eQFRu+XozmcJqvOoK8RpXTeJ2UhQN2E4jtrP6KhriL7BDFfGWHtoz5zcW\njt70wlQ3+WXSTQYfytWfH8tIG5ivoEn4xU+SojwUuhHCPwuo84WK944rA2C4\nbqvJgDBNHF25bG0mifsPtzBfpBzJqtnhoPxhaCQH+jEjsnqeAEOZXc5qmmLI\n5Gt/bEWKkz+XQPrA/4zsngRIZuJiVBULRKl2H1F7slQzbpgB7xjgW2ux1ap7\n1SIa3trK+cPKJ79cjybSvibUW+zBLjMrnqohE6CPRBMRZiYvGUT9PDhbxyDB\nZIh/EDRab1DohM/M+pDzA1WyKiqYtpJnfs59ypBJr5wz4CJt6o7PdeBS3i+5\n07QJs74ExjyYd7GSOKuou2fDFw/p3pg1+TZUefWO6cEyZVeE+ZfGftoludg4\n0g9Q5tnMrGailNaR4LLtw6wNcLr8zGGDQDOimjjRDiSqX2u3+6l0ta06/jFF\nhqwFwiqkp8z5qfRkH/ZfW2UqNdN3IvxTwCaVm8cItURFW9tWUf8gQFl4p6eI\nz2KqwmkYL/dooz0o0i/Egzxg5cdDW87BzlOJhrvJsVMZrZHJOsbSC4pD8rLA\nnnUD\r\n=rJd1\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1536919640452_1536919652814_0.33596792272314047"},"_hasShrinkwrap":false},"1.8.0-next.1536946017235":{"name":"puppeteer","version":"1.8.0-next.1536946017235","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"590951"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"f0beabd22a3908a7405b22b8e24e3c9295e1455b","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1536946017235","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-XBfnoNcOEDNm+cpRfz/H7GUC4ttm1PoV731kZvHcc+DsK4Zx2wDXrmx3TTpEvZ4wUuTekmQJ5LaP2Io8kfp9MA==","shasum":"25021c80c14b76a279ade69ed6bf1b23256584f9","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1536946017235.tgz","fileCount":57,"unpackedSize":612966,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbm+9tCRA9TVsSAnZWagAAK/MP/0QXfLm/clGEGV4UlMQz\n7HEEMX9h2Doz03GFApocBkoouH8RHyqbDdJLiimvNbPWJ+irEjFDr74h2dVW\nA+Y32A02jRh6prLKC/UJNjaRKoTQGckVnWDg1lMCCFxcs3wyM8Pz9myIZm1u\nFkil8AiUAsGdNNgQ9GD4mqu5SPT/TknTflOIS1JCdTxPq9DlqPR7yD/MJtGH\nRSAbQ5wuTJGeBVpybfc48BGTZbhPob9GL6Zer+qIEPHVXTD82Jkki8hbn6Op\nuP7tW2evpfgn5JnGLi9b++Hf9T47LOd/YIGdIqbfj8GUzv1K2E9Nga9FEZyO\nXQE6FkTq7sejqer/3+/PpWPaGZw7XBEnGEPYUHwabZxFCzAlxiKqQYxfKltB\ndqOiU2TnMjN2xyTTPDsTpY/3SZJ7XaEbo3oEzqa1oSdWZ1CL6Z0JwhXBttHN\n9qnOAEC6OlfOQXp/nvuEYaWwINhuWl6itogwQeHonK383V/IrFkh3CaPvXiL\nl1Uj469PF9uLSXFhsX4LrSekY2kOfQJ5mApa4cu9F600yZkRZWkEwzDJ3mqD\nT+35HprTEiqR69WieVUNrgN03P+IEDDHhDKRNnodK4m8+uN7MPdBjiFn8m9a\nXp6OtIEkidT2pP6USJQ0u7kD9xCGRWuAmRvj0Y/hwA5om/EZxX5BDRCq8fJf\nOJVO\r\n=Qjp0\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1536946017235_1536946028501_0.4580767431090891"},"_hasShrinkwrap":false},"1.8.0-next.1536950888728":{"name":"puppeteer","version":"1.8.0-next.1536950888728","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"590951"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"d547b9d24a803c0adf923b3a821ae5f43e79bb53","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1536950888728","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-K9lkv6UGbRGJKncCNwDNGEYNnH/ALqlG7zZiXLWqZbd4PMJ7AAfwUCmxfeMNOvll73DnteZI6DZNay2x/t2pQQ==","shasum":"02d9c47d7dd5b9dac807aac1d4eae679d90f8639","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1536950888728.tgz","fileCount":57,"unpackedSize":615018,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbnAJ1CRA9TVsSAnZWagAA/gIP/RreDpSt/ozw7VfxkkJD\ndnn7HIMkePIZUdB0zEopeNaixFD2MLIouQnIs9F5pFZRmk00MwjjzbK5Mbn6\nFfCNwmu7hdKVBneL/viqoaFEThcDHJR+zGY933M5S+MgXD5dxGffWX5zYcj3\nMXvPDUpNywRpL1qYf9hIGCiSL6kAdMR9fvVi1plcVZMDuBcSnmPsVSHxPUAL\nLer4hcPNyIjl4KNBZrLsAdtwpSiYSb+s5R6zgWn4FKiLaI5kDv++M+i/zqEC\nPlloop8gSO3HtatpHoYl2avRJs6dlc0hPVFhx0QbwRZ8/SDQREg/vXkb73ae\nN3Y/USmUM/Blceeel5ssilKLHD6pG+aArDvOR3UqSK/cxLZPaTkc33pl454/\nRnua+8k/KNXq8HGzvY/iseJhlQxoP9/XJKFpfRbDWNoPJ+0tN1UfF56GDXLe\nkyJmlQEQ67wN2giQfASmbFY4IH4F5TTMZzz9KOxjvWhq/dcKI+s2u6jnfusR\nfBGouR3Xd1V9yfuj2Sv34GrcHmK5HSIrlCfuV8T69N6I6ltZtTRYeUZb712u\nWQLsN8iSnGD6pMcVRvb9kFC7xoiRg+Ws3GSMKbF7Yuj3RoF20AzX7ruYejRi\nXrxDsHZbBMsZfKSSjJSNcHzmGRbMOy1KfIpByI+wcEejRcMgxJhH10TnU+Fs\nH1LM\r\n=fa1j\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1536950888728_1536950900859_0.9762402694799945"},"_hasShrinkwrap":false},"1.8.0-next.1536951103472":{"name":"puppeteer","version":"1.8.0-next.1536951103472","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"590951"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"f5d388af7dda492f3932f8c21e9f132e306565a3","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1536951103472","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-3t2v0vidTBpMzKTNWLIgJId/tFqAF3df6A3ZCAWFob0kfYVHmemb4qOSM05nNeKg64Nw5mvw6ECmVRpGtxM1eA==","shasum":"3b010a538b3ea9decb1237d08d965d42fe083a48","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1536951103472.tgz","fileCount":57,"unpackedSize":615018,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbnANNCRA9TVsSAnZWagAA0sMQAIXAjzZvlSMkCWHH6DvM\nM9dKNYWfp80JrqJYFNmoTQU9RmAdD1yLlPnryPT3qRVoCpYKIt9z/qejSecG\nRX2BfWN5pHh9MFZcrn0ZNmi45v/B3jCsM6tOpYIBt2YpOARDwZcdKuO1IoDt\n2uBUnc0OWRJ4lrmaPn21Uhc6JRlDdzprxDm68ZM8HZH4oP5dTLdupordqLOe\n/MfPQHXkI7bTGeRxiQPENkhMqAqLYksgsxlS3akpz3YYVYVX3wI0kTqJ5JjL\nbkfKuAk/39cym/O6El5kuBIvBjRgng2gEIBEKOBG18pulAMelnkBbCmR42lL\nxELsmYWB+PQ9csrj6yjl0fonpQYtObFVB5wehat9g+VGp0Wh+iI+jeuyT1sh\nS4fn14PINFY6Nl75a4V55pFSKsfINUVgspe79zORK8lN0J8Ol/2bHtUXzRRX\nNXg40sdGHbPxcwwdUM9kGsj3S7mbjqD2ytsUjOVqO6xWtLhtRdvHwmAXmFS2\nlOPvTkWE+NqK4b7450SrNgdOlM773g9Km/uMZCyLREP9wA/oVakxLRE0Jj4U\nHIyoIbeilZ/IG+Q2nYMau/GjMR7ajJjQSIfDNcKVlzNLXyoWQh7yTZIAIxYC\n2gevkGQf37kR2u/TqZi3SHREpYbgHL5mmHVOd70Z+hJH5+XC+ULgqSW1sEiF\nWHat\r\n=kM5G\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1536951103472_1536951116434_0.21473707824283372"},"_hasShrinkwrap":false},"1.8.0-next.1537204703840":{"name":"puppeteer","version":"1.8.0-next.1537204703840","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"590951"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"7f00860abd3c1efbca21351a8bdb12422dbe7aa2","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1537204703840","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-yd3INr0Dq9sG9p2QXgOIh8+ABM0bAfe+eYqTeEtbVb0s9E1AfwHPxf8aLbP//Rn3YDLEnwJE7AY4TVyrq6wcZA==","shasum":"4c6df15503e0d99a708a3cb8da79fbe4e9e93f9c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1537204703840.tgz","fileCount":57,"unpackedSize":616346,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbn+HqCRA9TVsSAnZWagAAZ9UP+QF2QB8vDR3Z9FanliUt\nEjz+HWzZtaQ7jN/+zA9vL5p1QbInTxNUA7RqnIvMZg/RbHDN9LcHNRUEnXRP\nQnH4NTE6uRwmBhIyLQLqqyco1tCwpD5WfkZkdk9pWfSghVfCYzRFcOJUYOiy\n3EKpqOXtOijoCjdmcaB8g1iZkhuD32NYd0rKamGsz9Km+cu7d977bZhWYoTn\nIAIImte+MUQcdcVN0l0KdshdWGQYHGP5JtoUtRSs6Ce/iQDtxXNLEP/1Rx6l\n2UzLxv8iEet78MQktQCMzXhtLW5zIO10qLsPskfS5CAqjy4SKTwwcHJQKBH/\nzmDj0tDHT4hR56HY618Y2C1cfxtmtP7HBzLgwZQabJYAqcRGCwRHmpbzGBTR\nTFvhvQS7FzQPLjQk7b2foKkuF0nxyYCqjrx2MaoahPBkXaIBGElUEQKkoecD\nSClwJIMDtm8JUmVCejsIoMKrU0f1ITU5+J+Nc4CD6bSalvkp2rcgfnpcDZK1\nEV58zsy1kkmrvWwtLuERMC8TQXOuinuhIJQrzOyzrldRZuo+uHmoc4bAQoOS\nQqiFdi4NJ/VAA6qtHFAOOoXdKyWNacuGshwqEMdrqLl4bFqWQvTosXFAEx8D\nkWSDo5UZtxZgSBSxY7G2FOSLZxOrSX26nP3tEd6e68xOS2ICu0IKHQ2948oJ\n2nyo\r\n=cM1h\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1537204703840_1537204713897_0.18038400591849402"},"_hasShrinkwrap":false},"1.8.0-next.1537223108573":{"name":"puppeteer","version":"1.8.0-next.1537223108573","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"591618"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"a1a211d9e797f9aea80206a018271390a6958a5f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1537223108573","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-k0roshkoPmMXsYVOoBrwqHfTTvy0ooUjhRM76xOLs5yxaZe/ebnJXejb43KOs6JGTlCMsYYMiP+SxHHzqIxdvQ==","shasum":"3a5eba68e3e8333d540234e97a14f07aec48610c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1537223108573.tgz","fileCount":57,"unpackedSize":616346,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJboCnPCRA9TVsSAnZWagAAGg4P/0E+3u5mzXKH1mGf0nRw\nqLij21EopkcJZO2F1MhXQxLTfzLhSPOxLwtCaYQqZYBNl4Ugh+mClk/xzmmV\nftnzRn4n0ySLj7Hhn++XTv+sxJEyu1m+h/h2ex6mERGKe12cAdS2JnFL+GkA\nGPzy7VbIOE8HAmZBiBtYLd1Xeli/vuv2EW89GlepYikAZo0DDtv29Ag04m6+\nRPpp3SXMRUGNBy9ti30fL6CVt3y8LPhHRn94VKl7TTn3VIe4XKjvTPjS44ba\nUnqTmSsl8jYtokURSwmwQA8JWcrVYaSK0SCJ6oR8OFTCA6uDcT3HAL9PJSSu\n/BTy5HIpu+yGjqQ/I6v2xIhhSiqfbVcwdUTZRu0o9VTad82xid6UVoxYnS0o\nxZUpkB0zXHdVGPSOM8ZFn4d+anpQ8+49b7YFVrjGj1wUqwvz/8kW4we+Vs3N\nAZo84lTKkjS4F8/leOYfLS5YQgOkhia8GSxb++BJ99PyvdBYj6B6+qhddYxD\nW5hxaw0nz0VQEVBer9xQLJmzdKeTIkTPWKShHR5ywKPYslsB9MQiwRcjSmE0\nLUFANEXu458UhQZFyW3jmbovMiyXEFba5TNIVN2jTXaodHzUITxSSpEfn47f\nMIb492HRZ3D12aJNIWTJjQxh5jBVgaB9R/gWK55X5ojY0Iepd+jnjcdbE1gH\norig\r\n=qJCc\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1537223108573_1537223118947_0.017948086651449424"},"_hasShrinkwrap":false},"1.8.0-next.1537226285635":{"name":"puppeteer","version":"1.8.0-next.1537226285635","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"591618"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"b97bddf8e5750d20c6ba82392eebe2a3fd2dd218","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1537226285635","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-RL+uLFDduY61b83MSl/4E8XWJt4NvpiTeVSefS9HweYNHKmvomW8Rk2Lu4Hgy9K2Q3lIgC15Y2gr2s0l6CGWOA==","shasum":"47e918f5ec8fe59b0b574220f5e12b1f7e299105","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1537226285635.tgz","fileCount":57,"unpackedSize":616498,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJboDY4CRA9TVsSAnZWagAAD8gP/iSC/1JbvcznAFUzZWzr\nJf3lDmvPd4iIxlLubaTkLaTEFPob0sxWRoMIwnFJXSHra35W+nZ2x4BdrrA4\nnN5unZfztRK8SrXIB3CGffY8rC4aNF2QqPq5aygsAHuQYjNvC/r6J4c7x9x1\n+hQ0ofB+d5KIfZ9aJlSTmu56CJHXkXjqGn1KlWl25D9KwH/YXl2i4hoLIrOZ\nsrMEtW4YAFCcKsJ6jK4P2BjGlDKpSTuxdebzdM2MhAJIjgjtarNlohUZC5ju\nAPVyALyxqVNbBeKbj5356AWWMSmVRMidxDUKLIa7Hg+AtdNRXhnMg+AaT43k\nZwMDE4V1xVYLP/pk5YBkUt3ecpuYC9CcUCwIQuZ+jqOm9KICS9BK5sUt7fOc\nD7s5BhH6nTaxnTs+UVs1GaHVTiyOFFOYvRSvYMUDWke0yn4KkKaWoA9rhEe9\nDu0bjEWhOf+utNF5PtAo+92mFNsUJi4NzvRFh2R44m1w4TGjOryfKdZGMMSx\nVK8R1fUe5q/l4hhQx/9GW9i0dPLFWXho5DDv+gPFo/FtpnI+SH22/YFm1wXR\ngbYEq17uSXNqnW4K5CBG84iz4+hQtTAW27jzijXrWkx4prYmcKibWmJEJdtU\n1MVxLTd0pLrxRlFEAxGzh2t60SFIEgUfzf0SLVNnJxbF+ZD9l79m+2/bI6Du\nCXWQ\r\n=iv4W\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1537226285635_1537226295859_0.5210897738309554"},"_hasShrinkwrap":false},"1.8.0-next.1537362098762":{"name":"puppeteer","version":"1.8.0-next.1537362098762","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"591618"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"27477a1d799fc3235c9e6c42683aada0dbb5737d","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1537362098762","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-2+YITtNpNBo4vlxXl+l0UUkUD3odnR1d3Uf+aUt5Ry3kV2nSEgx87lnm5Tx7xfHW/WtzlOahZatZj9CIhjtx0g==","shasum":"01a43228dca5eacea84e7e55cb99041ede24a7b8","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1537362098762.tgz","fileCount":57,"unpackedSize":616498,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJboki+CRA9TVsSAnZWagAACmQP/3JfRLIc3HJHHwTFZiQ3\n2yMHjDyIim7Uyq5ADyYurqeStsm+4UFwnqQqWKn+2L2E19uMsY3dLnkluTTD\nfImcWyxl9iyy5GA8+jeEvxHV4swmGS/TpZ+wFgLbHpi9esRl4cyPtWNdxu3o\nXD9qGYVvzebVm+ZVSkzc8npRjYLpI9BFTYIzZWOL/sL8cKQ6eQ5MfLhs4BBp\nQ9Bg61kqT5YWjD4G3IKwfaWzvDPYSeYpQ3WD5+yQLc5QnsKWEttlvw78X9TT\nlewjK4xfRWacr25Zm+QBr/IOVUYaBAroYmdavAk+V6g+JBJnZmL35fmtfKvo\n1ceYRJlbklIU+AozIk9AKCai7cLmV04cVnf6mJ50rC9hvO9MWJt7F0I85USB\nsi+D8gnmF4PrLlZsGTSfHtfajrRZCPt6QJIrshTqZJBDMURr8VgMOevprdOJ\nRl+/XQ1S1UV9iP4uR3xjJtkDBfEoDnx+yRocviryI8G7DHAB7SLC+7aV4h6t\n9LLoaZ0qpYb5+9ziTaRPlnmq8d/RQAU73+0Py8l2nnTCbjAyQf+kxXcwXqdz\n2lNp/JRw17zArfiHacrUQ7Uv+9qc161OAbKo9an2ujZCZGrucpq/jTpQOb46\nDZ07u/WfKY9vHigV5E58P6bX78761rhrudtOcYgO/prOpGw9oz4I0TyrTmGU\nF+jD\r\n=dNQ/\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1537362098762_1537362109643_0.8495535308804101"},"_hasShrinkwrap":false},"1.8.0-next.1537388094387":{"name":"puppeteer","version":"1.8.0-next.1537388094387","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"591618"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"9223bca964a358e8105efdc73f2606f637a076c8","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1537388094387","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-W/Z1cxhv3V4Ae/eO63XP//u6CLbNZJefWLlTTHd8NJ5Z8RxoiPhYlSLASah/ycaiwQKVPSQ57CsLUaEJtApkZQ==","shasum":"aae1f631cb7ab5d020a3b9f26c40501a07a5d53e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1537388094387.tgz","fileCount":55,"unpackedSize":617838,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJboq5OCRA9TVsSAnZWagAAaNAQAKBBhKpJgM8NSrjy6bVs\n5nvK0DpHjSGnROAbcKqe3ZNMZo4WSf7jl8lnBObNKlIiIsDQ7erKQgV2zcKF\naTey2IWbQoKrLqZkeM4ImaBcvXYMPvynoPGcOI/5BqFj25NkzFiN0R5svx3U\nu5Ver3ZG4mpAL17djgo5EdNWXxxpjomOsaS00wUH+XdwQvKS+9xaHuAbDmRB\nwYJpyvKXqhIe0ggXb3gEk0Ex842pqm3xLr88QRXIC6XhByRQGtE6s5n3/TeS\nmNDAHVDltesM45TGhveBDHk5foeXcStMREsT29DgCa8rAQzC2+toz55GOTSD\n9FndAETdD+DD38hlyCFhL4VDpPb91M7jpWCGNuhtEm89ajLxHHTsZvepnqQ4\nL6epDChYVaZj+xYskAfCQAcW3//jI6/b1Pt7Hjr3iv08JNVzNX6Sk9PNWNKr\nhhwBqPMvG92TPba0pLO5U5t8wQHZmJQBpb/ZGnm23gB3OXQxZsZ/7BwHR1vW\nWzx+tbmMqwoPmfIYFEK/+GfzWuifBxq/aEBnK0lCOmyRbB4uG0oAh6q2Tehf\n1N6ckMe0mMD30jCMZzynfjwdR2bo9e462Be6R6yWBtSYrAzatxSi3v7hVw7f\no8lXl2/1J29G4NEE987KGscAdQIxPuHWwvBYgNqdjlRtkDvOEqztlz2KV7/D\nhxYo\r\n=ImiD\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1537388094387_1537388109975_0.4505321954081942"},"_hasShrinkwrap":false},"1.8.0-next.1537390700271":{"name":"puppeteer","version":"1.8.0-next.1537390700271","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"591618"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"0b9d8a62717ddf5d77a0ca6d6bacf8d734054853","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1537390700271","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-PH1PUZBHJHYzqlWYmtplckIRNe9dD8C/crQEAmhQbL3wwivAMczC6OSq0/8DYwrUFN9ylFWX3usVu/w1Uqq8Dg==","shasum":"53b636800b2976b580aae585516447beead0d6e0","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1537390700271.tgz","fileCount":55,"unpackedSize":619682,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJborh4CRA9TVsSAnZWagAA+j4P/3QS52fXxm4ObcZQKytI\nPFVnF/cmfwRMqFLckf/b8wSmrf9c4nvCRhZJmKzdiHuCk7TcwTguK6j9Z23/\nagbGBCYXT6Gb1WH1tAqIVpw+2fQ5IffdzXhQi384sitXA42iV6Qe33xo1n/o\nm5/XUpz1SZi3or9iemvMk7E36wWJD5VkFX8zZyux1j5ivp7soc9+AsjfHE+X\ntLLXue/GsjBfp5qMT7TeJTkkEvjqi3Fd8RXwGHohOF/MvhMTnitXWoMV9TGb\noEVRGehm0Y9Gny10byXyxuFwQleteWq69gbqnY1j5Mc/aa3dlw2KZ433f24P\nDg8Y5oJHUhFZUWAMUvYaxeYH/GIxhp/cEATGpBFyRdfWr7iaAFaQjfx/cmd8\nUNOYvH5eZjv2BV3nDB3rNTst5yjQpXY7ZUVW/j7hOPBdBKwddeuNrA0Wifh3\naniZi15RM9+t6aPVON8s6lO4yYchD/j5PkW9KIFOE3izAIKIUITkw4pcYcEi\niMV94HwYQFLCs3rNRp/4MgmoGbe0pPXcM9LlUwb4byZeQgdQsyqCt6gK1ADC\nKo3MhQU9VhyDT5bSE7Ron0WS9BsbR7CNlfn3v21s1wnMbg7CGH348RU+0xgb\nmAVDTgGX2ln8jNblqxUS+j2I6eBmAjI8Uj1Yu7HkFXcd+JYgITzTX0GtDMfG\ndUuZ\r\n=wq94\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1537390700271_1537390711946_0.5849705373119505"},"_hasShrinkwrap":false},"1.8.0-next.1537455065839":{"name":"puppeteer","version":"1.8.0-next.1537455065839","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"591618"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"ad49f792a44195a615d9f7c2d1a065a02badd15b","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1537455065839","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-NCh4DdTW6O70I/fCnPaFe+xqN3QJ5jU1rZVvXdcHkdMDJuwcdWlVAYOsOBxTH9GqBn6blJTiU6UxP6TR4OQ0/Q==","shasum":"25afffaaef94affbb72c5ab6ca5d07c30e01d1df","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1537455065839.tgz","fileCount":55,"unpackedSize":619682,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbo7PlCRA9TVsSAnZWagAABxoP/joMepX8FslXcsbbw9ME\nUGY6XWZABGFxpKT6ZxWLv6jqIhP1tvWaj6+XC+LvBlQZZpw1sv2nv9CcLbEO\nQymKbvEaSpGOaw0Lt668dUv90MgF2HERy3wKN9s6QyVQzguFyS49vqcyjYtb\nUdVy3ObQ63ANIUnJ1vGd8Ru8lispw/jEnoLN83sigEEp7AtWBhXFuzN7Rtxi\nw6im/5RtQw93mvhnEOacYxUW7WO3BYPwANh0M4wu/rozH2HN+sU6lUslnReb\nr2JhkXQpbWwtLLfn4ofAFMejHFrSlnQFMK0SFgmh6FV4+x1o5/MnDqkG+v6A\ngjD2Md03SacdaV2mJvqV2W78UMh43Fyrsd6Qo6MQeZmLZJNBqLgh5auH9pyU\nA2cP4XajaVI3l5D5ktr0aDYXaqTv3PdAi42lDB9+pIFnoWznDjXVLCai09yK\nE+WJtWx1b0YXq+soOgSrVNuU2aWdZaAbDm0pTVJfY1Q3F2LuXmfl1rlmhyGW\nRVqCuBw2pUOqKY4roQpOgJLHEOIDtTEqxjBiCvVnBk7PMMIgnS9eDI7cp410\nISiin1/GNuXUW3vYZnxlXpvN4Zk8EwEj0c0o58TyyPOYQWpSGUYZHOXiKeOw\nyUaa0wHTRHvYIbcAMNv+6GIIMIvwg3NhQWbcEuYhXSavK+LhedgkTdBpK4vl\njDwD\r\n=1ssO\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1537455065839_1537455076286_0.892604070300111"},"_hasShrinkwrap":false},"1.8.0-next.1537468425440":{"name":"puppeteer","version":"1.8.0-next.1537468425440","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"591618"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"5acf953104a09d7d688d76eadced6a4eba75d5d1","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1537468425440","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-0CFX7MrdzWSzV8LPqJ1zzLgS1uGY0rtMFtIw0Irs67r+awuujmyD/RHT8vbwUY+kEL9TFyN4yzG6iWZt4BpsMg==","shasum":"e344910e9dcb5bbf3aded6279518f7637e69a660","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1537468425440.tgz","fileCount":55,"unpackedSize":622330,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbo+gYCRA9TVsSAnZWagAAsFEQAJfI++bgp8HEs/1fwiiX\nAo//+u3JXF3err1sSt99svZ58WdzXQNK/bUYj/tnL2+fqWm26ym/P0y9fjfR\n4UT2c3OqWgJpVGCCgSD7ML0tiDf0WtSvDJQOFVYMwdY1yIt3t02CwQzPfHxj\nTnA8ahSGxqWRGajjVPPhPHdXi4fbp5CrXnVQ9uR9qwL/lohyrzSODzxIoRqi\nbr38CbAchuaIteY5/9z0HwzRg2UCIPmggAbxU3M75mEYgX96OFEeUwEtYtj2\nHu8hJmvfw3CpJ3SEjFcmX3DlvcKsEYIPJ/ihBkAQ2od/anNyjn06d96Mb7H2\nwl0W4Ax6r38Cwa1TmS7qTOqTWdhLdO1sRz6Lqq1V5OGvl9OV0b3zoHuj+CYp\njcf1ZXf13AqQFBYpvC18s6ZDgAZS9hXiuIj+etQ3fRVThNnAay/xuDiXzAyU\nwi55COI9C0KvU8duRlQE6cYeXxkmzNdA/8yQp8eaDlG4xAgNfS458R93fBE6\nwFn0nidFhDI/+52M6BdbfqKZrFeExnV3jdfllCV9tsvvREBkEnTB4S9IAiq5\nTGZSsdfOURKMb4SCevOzBzhupKsr+MlXEDOrQm1XkJGa542bj45aAxWi0Tuv\nB22VHNDaaJ1OrZAO2oQKsfk3VV80GgI0nRt+53XeOVt/BDxxNfSuovwi3VNx\nmwzw\r\n=3XHX\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1537468425440_1537468440045_0.6688961885128815"},"_hasShrinkwrap":false},"1.8.0-next.1537469893945":{"name":"puppeteer","version":"1.8.0-next.1537469893945","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"591618"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"4e48dfc7a195331ab1ff987d98290a6ab060a353","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1537469893945","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-EPZz7tmtdHqFb/yGrhmMmAP98hq3uNE5+0D2/JME9omsxZa665zxUlzeRBlUL01JwocaU6kV30cbJAA47r1q2g==","shasum":"d73ba06c5d6fc60c553c2c7f39e09194c2863ef4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1537469893945.tgz","fileCount":55,"unpackedSize":622746,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbo+3UCRA9TVsSAnZWagAA/M8QAI7LxPH4ZSAKerMFuqwb\nk/M2B3vWe4kbwHIKsCgVE8TJh/vg3ahivG7csX3ERo1D5PGkoxUW3aA7Erid\nraFc1x3WrM34b6D9yQQIQsfJoR09kc1D2VRRJXNGGM3AkXD7Y+RKT9GbRPiz\nJqeJkojCKvLiN2fBrbR+BcTQmPDcCOYuPogxcTkRsmC8+mPLaCPi2HKrAPIQ\n0eEsrBUkbdM43p0GsSVdptKBG8ZhkFUovNGB919b7I37e6HvMSI/Tfqow/8c\nH5NznP3Ru37E7lnoTUf1urx/aBchrw+bYQvsH95xSamxzakIUeNEVUXZiZEF\n6+LPORfN5AAnFesUjBVkQqCRxkeunfovAtSn+9nzihWvk4+7NiAJ05lTNlOB\nE0shfsEh9M8s3ReoYP3QBKNLkWptlKJcidtdy7GJJXxDej2tLczB4O+Y+O68\nsJAHYG1etJPz5Q1rKFjmOd8fIDmWzxf7zHk826ysucDQGETTnkAubx7ReNIE\n8xfiWt07Ko6FKeUq/9+1jy5C4hrkPeU/0fsn2VAGZ5qxvpnNiJfmII0x4eMz\nSdzUG2hsvf+EzjFcP3e5eXm04BySI972xYAI921KpIav2oA5sN8g140z2itr\nn2ppj1dtmJUmFCT7sR8Mf8vBb7UQlWP/J7HiexYnSfJTq+Vxwcb4I1osoyGT\n7NJ1\r\n=fHoz\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1537469893945_1537469907409_0.20483090866401898"},"_hasShrinkwrap":false},"1.8.0-next.1537566876820":{"name":"puppeteer","version":"1.8.0-next.1537566876820","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"591618"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"907d9bed6d68ff850d566296104ef9a07cdd1b0d","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1537566876820","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-DEeKLDMB17JfqoHUsfGsI5F/f6Ef0bzvfKXFftOvwAMPFilCGhMErNsT+iO0XLZSMMaqDfBgGBeNnNCT4vNgFQ==","shasum":"4b2515e4760dd76917acc1f4db8fcb37e95153d3","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1537566876820.tgz","fileCount":55,"unpackedSize":622746,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbpWirCRA9TVsSAnZWagAAdPwP/0NQpxGtYkn9sv9xBkOT\nDLPHV51IMNYZz0FmMnLzTx/ePt/ge9UNW+YXCoKwJ6WprdiZl2HpUaYkEMS2\ndM7L0buCPhA8JTif/NrxKbREAJMZ+N44YSBFD4YgUsxHwD1KZtFHBbXWK+fw\n+JvItuetyC1tvxc0L+ReRsGPOWhQQWSTzxufCVYhON8FfF5cMIywCVcKcmFZ\nUyuR/yJnZzKIXhg/LdNOEK0ubnXdD2/Hb7RRgNWYqpirIx7gOBZhIeMwyTJG\nxipxAZGzF0WvtnviOZ3vZmkslh98lNcAhGd0Xpo9e62hQVufxPi4At+HKuWZ\nz7KpnUcz0TjIoLsva80efZuLUH+tSMj3X1jGeHF7cC3tgDiUOW2hzuKASEiA\nZVu9pH73hfb+TCUEUkt+3zzoBEfgM4yD+81Yz47SmoYCzjVmTAdw5lFCG25n\n8nX5jfbDL9ODuwKiBxxXm93zQUA7YGhrA8X/Mq56725WDYrbmUrt1sqPYgbq\n3+jUk+jj5sQaO5zKUzrZCut1f+O4AhCg8YyknoiamxmYVPoNNgs/iVcbL36t\nhojSZAe/r8//dF4M0/LqYQ7j+2aFiyd2KJqsnt584koHW8KBSesaPy1hgokr\nlLttFPa7YV9S+/tPwnt26oddSnEvV5zEO69VFp3YKz6iI2NVj1aUgItTZOHS\nsF+2\r\n=KkP+\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1537566876820_1537566890403_0.7694827762198733"},"_hasShrinkwrap":false},"1.8.0-next.1537568897412":{"name":"puppeteer","version":"1.8.0-next.1537568897412","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"591618"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"5b3ddf554aab5135e8343bcff7738c0a2ad3667e","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1537568897412","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-cT0RfK01O6w0aFbJXer17B6v2CFJCVXHvvaceoIKq+4D8HaASrCsCSSUOOMEAN0HOYSQXjtSFq1FfZWxXxNnkA==","shasum":"6645e51fa3f1447b76cd461215b180d2d6cc89b6","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1537568897412.tgz","fileCount":55,"unpackedSize":622746,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbpXCLCRA9TVsSAnZWagAAwUMP/3w2HUwAHJCnyecuAmkZ\noZJ8hre1aPlbmX258FmnvF999vQ/Gv4VnrICwc6VlMjT3F/9Dk3MjLkJpxrO\n61oqK9/tlKnmEk8k/3ue3sCzGIjbWKlaegBsrcECMzxLVGzWyxppGaW7aZ5l\nCZ6l5Q3NbTqRB3NdUTbI/ktwxlMHO6T7SSPrYH/NpuoGEiZq5OCK9MPsn0Ve\nrgthQ19xXQPZdhBt9D6PrpVWaG8V7UHGUXLErOvN3Yb3buEeTEagX5pritfK\n9x2m4Y6Q10jb3KwEXaYNPjsQPwhV0i9thO5eMMHak0lK7YeQlImRBqvTOiEC\nZmSe8uovP1fFBh44qO7G1LKAcEqhumJdDpVczQ1xHAl966/2vVARty/9tlE6\nbz6qUKVB5zLEozeUAnrux6kbN9q7t2ZqxEmO00sBsK80aKXxq4hL7lEZj6To\nFfIs72ELvuIlQDoKzcVW5NM7+WV2xkhOJzrjoXutVSbGJ8eNhUMrVR4YCtX/\nce2L9WG7mW6ldFrFDHxC1FxT1rReAmWnLDN/VBTmTry7OMoldsMg7aOBJ+oS\n4avSNzo+5QQ0ICUACbndW7g4ZbSHOvCQ4VF32DWlLGhJdVw3OcTt30si/9yZ\npgTc1PrKY+8blYZS2bdLxBrWHKmP5KG3fixWTwZRqTC1e1/zl9HEzTAhnw4K\nBwxC\r\n=C0eS\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1537568897412_1537568906512_0.1897805324445634"},"_hasShrinkwrap":false},"1.8.0-next.1537576245114":{"name":"puppeteer","version":"1.8.0-next.1537576245114","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"591618"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"12e317ce17e7612817dd4d38ba048d7fc1859805","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1537576245114","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-9KJGpMqf8DFtr3HvplvnN5Cjv9emP6T6rbLPD5CR0CZOBHjSw/IwjjmNm5qrjAoiQaZ2mGuMEnHum9FtnT0tJw==","shasum":"b87090de19e908e06e637bb8b8ef6c9d2706e02a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1537576245114.tgz","fileCount":55,"unpackedSize":622746,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbpY1DCRA9TVsSAnZWagAAG4EQAJFRmn7Uw7UOHV3uZ0yG\nk6sVQCwFqSKJSFM0M9Ly3T8stfo7zRSIsaCVYXNhpeyHss/tSvhHbdAL+Y3m\nE3jI4ClvZETYNQn2G/TLq6TnVDP6abhh6YvOQoepYeigUhGEV//NclpXIjL+\ntoBz9TMZ8gVuhmDcBEZoRJj4gC31s3HsrC5nKISclXtgr0693AUmYTGH5OHD\nz6M73ZtLEO0n9DnhrdeXFlNF5GfDkk7IGPSMfGICIMmU/fL+P+l1n4ym0/JM\ncxnDMDiWbXM4DEihARPGo+k2DlTWo5qRYee1OPsLOKlg1E+IXeNGM+oRnOZo\n3dffXYSvwbzbv+cssTN55cRqyFtf9X9RhV/WeIDAjfqw1UwJySUceYM3PGXY\n8sULyxbru8hGFogdxT6T2l/SlwN9iA1QJya9J3VHek0WLbLeiVqwZTIIk82M\nt2uf1gzjjXUxG9ahGmnZoxka9HyJV4O8eVbZqgwMg9DmCuJwhPDf2AKaK8zI\nHxGWWGPEC8IBJr54VlGW8YWqrw0u4hbSdzjB3MfNniukUHsw3U7uRrGee2WY\ndj52UXUa1AvnKpCqAkG/gCqJzYy6fY5iA220xL/ZRyaofCeOL+qOq77ix5ER\no0Mc6n5cr0ntxAX+BMEEd2EeD0qT5n80cQZRzuSLD3UH30jm6LlRMRXaXHhi\nMkQC\r\n=iUB3\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1537576245114_1537576257688_0.6850736074473027"},"_hasShrinkwrap":false},"1.8.0-next.1537588058879":{"name":"puppeteer","version":"1.8.0-next.1537588058879","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"591618"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"9c89090f73fd4dc06748ce39f0fc54c0065ac23b","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1537588058879","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-B81aq2N22/kkirScB8qn+MOPLKI5Pmqv1fMpFuLfUenKkuBXuFRpiidn6FibA+5Ai/42UXge5ppmu6mRuCyjBw==","shasum":"d23fb105df3bdfeaad1033d0fc4961cc5f67e979","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1537588058879.tgz","fileCount":55,"unpackedSize":622746,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbpbtmCRA9TVsSAnZWagAA6DEP/3WCGyhuY6B9wToFh/XC\nuHPXfv7XO7KCLEhk5hDFh0uWC6I20W/pwbCkxcH01DYwevGy/JeMzdtw8K2A\nnIkA0A04bXoj+5s9yhbfEwEvljW7ZG3ddpr7lXLQ/t/vTYyG+nQb3XUwKGtM\nruTEgUmUXcC1gPYnB4BKV89MPmmWd3wyBsPLv9woWMMKNk40buuwcTxtm0UZ\nHo+bOxVLCyEauH+ZzhzZFqcci3NfAQAlCk580XPF0JuAHt12BBfAy4BfE0JK\nh21yr3D9SGsctF1+e50fNQtB/39HruIm/cZwkpSHGu/CW4J/WsUkbew/2XaY\nqR7Mu6DSNwtPBWRlSZJ59PifF7PA/AvO04SLkP3Fk8hoBOpP0VGNGy/hz1eB\nEHxbMdGdq15zElWwfrb5nHLcWyJtPrZWcYv9jN4SsCSQU4PdL/03otY3Ohji\ncjK8I+4DIZAT0u28bS8Oeen3bkW2xyRI/J1iwnU5TIhFShiIdPQ9Bgv8kLyV\n/izazKOoB8bNo2ZzrAtX8NKi08zR35Y135dHVsqxuWqsptde6zeB1J+r8FZ/\nYyxi1PsuqHORRjZEWBHxude4XPQQsflfeSxMlYSf+3xAXQd8h5y4hC0BEGQs\n2UEg+tqbCZrCypuEEPEJcWP7f4BwQJb6SnMmHxSqjrzeyun1iSw+U9zfMhAd\ne2fk\r\n=0sm6\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1537588058879_1537588069781_0.5811252318137903"},"_hasShrinkwrap":false},"1.8.0-next.1537818606608":{"name":"puppeteer","version":"1.8.0-next.1537818606608","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"591618"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"85aca8e1a56b5698f447ffd55b148482bf8db7ae","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1537818606608","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-5HQln7I43to7mmK5hWqKJVwjUB/C2TKH8G1L9vjViiBSW3VB274Mvfs8Tj94hLYLRkMtsbLXnmdgCcfBRTNI1w==","shasum":"453cbd6bc3c24a77ad43462a617134770c35cdb5","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1537818606608.tgz","fileCount":55,"unpackedSize":622746,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbqT/5CRA9TVsSAnZWagAAyPUP/i9E55s2oeQPI9lYc6fx\n9vQaOllK7v24ErjCl/PGs/u1yz9MOadBLJvLvKuK6bUYmiDvMA9iDKR6ozA4\nlTZpYJm5eI3xHVDL5AgyyQKciS7RQeX8JONekLMa4uGGoNxxsaibpEvevKlo\nH2eB8Z8MK/RW+liK5ddqx0POCex7i+wShmynLz8IATvtmXOGLSKlEsmm7Fgu\nDAAqy+Yg2oCsdTIhKdx7+JZXj/65+UrlV34XzVoUH6FWI1z9DxKHe/KaOe8N\nky0WBuTMv7I5ezYJyPA7TTc7ZPja1ROGRKljEJgl7mKiMJYV8iD4zA0UHelc\nWN5C4nu2Jb0pLfTRXAwBEJC+p+RtbohPxxD9Vx6N5CYb1MjcjfU735NOAGMW\nF+sJwb4Hew+w3tFvWF4A4sJS8/upeqODZuKnuNx6QCFPtiT1O29/64jVKnjB\npgJgKfHxwLZVQxO/NNw9VBHW6K7z1TWRlMzra0+kWQeJ1CXOwyuLZkEqI0g7\nXUDVvN43gcezKJG23ujHwjOlaUQ47WxKPA2kmd/+RQtDqRld7qg0Lyyv/dMb\nz8o8dEjqRhl6SlFkqF6u2LvzSb0VOWyhRF6Cu1LsHR7qE0c0UpSpndQ5+Guz\nuia0O1ifwgS63Ns7pVl1f+lGyirhjtZZH5vmAhxCOaRMzKfDgJ3Ocz5usDhr\nPuGo\r\n=Q1A/\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1537818606608_1537818616571_0.84567266051474"},"_hasShrinkwrap":false},"1.8.0-next.1537978905474":{"name":"puppeteer","version":"1.8.0-next.1537978905474","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"594312"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"e75e36b9c2c0fc47b5bc97ff1f556e9ce1fa2e18","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1537978905474","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-JSNkaKpCC6sbpNB4GIEx2dvCll3iFlIFx4Uik1r3DEYVEvSViapZIAUdeoXBRfH2Os2RFuvBDumF5mpPERHT0Q==","shasum":"c9c9bac9f851a869f18cc6317bd842e7fecb6be3","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1537978905474.tgz","fileCount":55,"unpackedSize":622746,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbq7IlCRA9TVsSAnZWagAAbdgP+wQBuuMwssh3CrcztsSg\n/rcurIeIsGFos+hiSe+lbjKGoQ5aZQNdSwYUDuiNMLdNAaidjfNy/v1I3Bfz\nyFKW1Jji3KaGitEL7Q6EWkUSfwSSo/Y93G7z+TN7soWl2UT34U88raVfbjzR\nhMMD6aJL3eZ2gESO9YdgGnZmLJijddHT70ebyyn/rCeEiQOUCl2SjO5KRljX\nxm9LPUCCwETTFxgZ42+VU8v/IMwp7d2QGHHWije814SBk2jbkGakHUrgYK34\niXf/YzdodDuCQJPw17qdIsjmpMyZISeAkU+ZiwmOF2P/5K0nF9JYFM4PPl77\n9KIIFgk6bPXsnR+r49NJ0oxNxju+FXI+hMA3UCA/DTP1/yaLjsz0p50ESSc0\n5YrY2P4uUSd6oxZhe6jKK8F7A3nV/c6XG9+s5YgQrJ4w7K9t2ZX48mSMkbM/\nCxD+dyzfLTmIys7LcA9RifTLMi6Dmj1DP7UaRFb6GPE3j7dsOjihUJHee+f7\nrK/GlpTyS27+SWi55EIavPh6SsOnJ4cTVWRPDo6surwpWLUfacgcsqhZDoOU\nhf8S0bPuFzcqwsnF04kkDuu+Mllq5cx5wkInU1hUwdRK7oORSrl4HV/+QYCi\nM2eefKvkro1QrBCRxFuG+uiwup7Nz1yGI73t7GQl5H6GJSGKWK+Ekt6KeF6I\nvAI/\r\n=yUgS\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1537978905474_1537978916356_0.3908993717697784"},"_hasShrinkwrap":false},"1.8.0-next.1538070839127":{"name":"puppeteer","version":"1.8.0-next.1538070839127","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"594312"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.0.26","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.0.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"842fee860b788fa9a179857a0c35615e5f12a9b2","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1538070839127","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-tIAiOPbUctgECHNcXzjI93vYfCdJTBVla+F6NnocmdkfKM49UNaeN3684j4WN3H2LV+8Fj0s0W2ND8/KruVZyg==","shasum":"cef826c679494f30466c7184a730fb3733479b44","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1538070839127.tgz","fileCount":55,"unpackedSize":622498,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbrRlHCRA9TVsSAnZWagAAFPwP/RFFbYdKt96RGWRRvWQD\n9+ftzS2C1uyPCPV4GziWoVKRFEJbhVZfHi6Vr+QVgGwX2DXJZHLmNAp17f3X\ngZ0U6q5BCSOEW3EmNeAbBiPpkgTTGVQE5n6DZlc+vyMfqELizvdvJvOkOMxH\ngvLTklDkCR/OezZTSKP5JKRAHsxiGJE9qtbxDb712y1OXF5MboY00V2fGRkR\nkZ1J15ycJrsISLFxk1Q3NSSgw63+0ig2xbQCliX0Da3qnliF57UhAmTYsCJ5\ncnoXcCiZABh1EGRcmE530xfINVVSfWwRtf0ENvqWKvp9qm5HxTsKGs+rhsRT\nyeUPL+vNFk211RRh2OS6ivHvc0zDRDY5aBUt6trIA2T5DLsbZpcUsBOk19Ym\n8p8//WwnwiJCNnFt+8BGlxckKg4j9ZH3j5RpbUYu632UXa7K1YrNulhzRYaF\ngNzQ99LLSmZg5d/I1Mqhktb2XKpML8l+2XT+PLQbCYPlcLDlKlxLHtptRYGW\nMz9/Yi1TF+0HJbmMGvpm6XxXPML90b6SDy/YghO/sL+jBFS/4KXGJ5AgMEHJ\nWeTFG4Pdt8pf2caAfIH9LXje1IDqxDr1In0zWI8XJIeoKDKifufw5/Aoka5r\nGNnNDu++0QThg1tHxRm/wz642vANOA+bryqZ0UePRNM+ppSQqcw+qLfbuj10\n61ts\r\n=/27x\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1538070839127_1538070854625_0.6586320337420026"},"_hasShrinkwrap":false},"1.8.0-next.1538512930517":{"name":"puppeteer","version":"1.8.0-next.1538512930517","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"594312"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.32","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"c9657f88196dc97b200e81418ec24b41587849cf","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1538512930517","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-x419mpSMxj0KcAqx+TjJLdphagX8kSQl11UFTrdAuPw/0Ol5xT732mhx0tveU3RpyZL25Iq7uBSF+telOk/8zQ==","shasum":"faa429be354707098754758dfe99d13b2c58c49e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1538512930517.tgz","fileCount":55,"unpackedSize":622839,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbs9gtCRA9TVsSAnZWagAAMN4P/28fmNl1qDGnWSEMrl2W\nQskgFWC+ljNJ4JXLEaqVzFiFMdmwY/nUv6roK5OTefUsbuJpvVYSQMc0sB3K\nqompsog7xKhfBgS0B6w5lgUjxnNce063oRBF34M7wKbqWzSZo1zQ3/N6aNuC\n7vVEt+oWobvYxpnZyOy8Fnn2m9hWEjsLnTUCk+k587sdj4JI8KZ2JKA2hqCj\n8+2nDQJ0bAreh121ie/N5pLp4yU7CyFfzsM08l/VqR89TpPtkqUo2FdUli4W\ndO2XA716t6hWMnCaRFiYGb6BocnVZAO1FPYkoN8I7pg1NXisEHmZXagKlAQG\nZlYnlbAm0KEDipOiro9excqTeVttDdD06IHW2dZCFM2CydYRUpgG75/unScZ\nCDPekZbuBwPEbToUxEfBtwGmwrU9l8sEWce5uydXY3IlyK1sZTFDh7HVdo/Q\nOhZrPGmqNR0BuYHesH08oLruzYDnQfPQgjQkIDy0IQyD6oLIsO9czxuHSBpq\n3mNM5taNS3DdhRBURf2WP6uxR1MSp0zkcmli+NFleDyVT6Orz4E7NV49yPpM\nRxSX5x8HO/uq0701+4Mq/lxZiBpKxCIfgDQ9qjVV7KL4pCHo/AViEyflBAX8\nM3g+Xw9tSTnmMQe5KwtEo71j8QpmuvQaXj/rTLOoTGtEiXqxihJGLztZ56EA\nZ5Sj\r\n=xND8\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1538512930517_1538512940436_0.1308583280056732"},"_hasShrinkwrap":false},"1.8.0-next.1538611414237":{"name":"puppeteer","version":"1.8.0-next.1538611414237","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"594312"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"cd54ce388eec426034ae7b7ee5058e54b5ac5da8","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1538611414237","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-hFOWflakel/ylg8gcfEIoCVmAYRRX7aAVDwq6zL8hBf4vfRCVB8TCBuvM5cVDaASOYK86RCQPLrV/G7PV2B1xw==","shasum":"a90c2048f011d208b544779e093304732a5a6afd","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1538611414237.tgz","fileCount":55,"unpackedSize":622629,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbtVjgCRA9TVsSAnZWagAA/KEP/iScgLgkyYo2S1wq65N6\nyuuT4ORz9sTIINFM6sHGr+BzVmO6oTFYN7Hzoykib+pg6pZdRNmHhHOpGri5\nIeBS1TpHv2+6ns53o1YYsHlNKf9EYs7tsJemBUNMW4dhsnPtW8kIi6QB2l0q\n1Uiehivn6A66PV/zv4QauemWS7VxMD1o+lkrMpRVwtjxV4foZZblKDyHeJIV\nMGCNl8Uum9YZSLIviZMG1CgzvpiK/YkSa1TqOMQ3rCltAlOJbWDFsiLjfCcq\nrAHBADfSRPQXnODp/ZcBmkqbZY8m4w1oVBwpeBBTbBDRAoH3mutxCxjsShz7\nXdEoh4PWTrfAJWRE1rWcNkS0zKvCOpk5X16HOw9HLMAhNhByiKzeGKWzP5c1\nsmr/YPu3mp6eB5mCcishMvKRfV3lh4L7EM/D8Xbx3Rs49Hu4q0JyX0TJXHTx\n4qhg5TewwhTbyy6rWD2ztBm75mV8tRBHM5KkSqRrtX65UnQMVmN3UEVru/UW\nuohJZmmH2xa6rCXWxDXp5IRw9weY/z0zBBqkqf7vjUAZjvX3/1vAlr3KYMQK\naC0h42Jc873XT2FZA8tVJ7ouyAAw5jhPyPM3LSJhZ3AW7UBU+xRDSB5G7w1J\nQmdbvLTk/rY9ScvZ/10VSfWGXr1TVM3Jq7Dy5vK3BfdwQ31x/ViNdKwZKe2b\nnECf\r\n=WnFZ\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1538611414237_1538611423607_0.7761173283719598"},"_hasShrinkwrap":false},"1.8.0-next.1538612893058":{"name":"puppeteer","version":"1.8.0-next.1538612893058","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"594312"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"5ebfe1a0dc89f88d3c784e546c34cae42cf9906c","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1538612893058","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-ZyPSeX2obRr4fMowQMdACt6QM2w8K9jnMzt/8Doj+yWvSbMpELLt8LIdnIgfJfx8u+n4rk54co5UiBJBCZFW4Q==","shasum":"9f1298de1af7b4543348a9c341f2c8fbbe418d39","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1538612893058.tgz","fileCount":55,"unpackedSize":622558,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbtV6nCRA9TVsSAnZWagAAuTIP/RwSS6csnRoT+9Lzxp2e\nAe7KOI/a+0wmV3HzHgFAruLrc7l5D6FqM063YQc+UUwdCUSjMI+nxfpRaPTG\nACfdQ8BRaYi4/TYIwdaGQe7rS57qEv8aR006teiD7cJ+byb9kh769/qxtv8J\nJMSGZu0UVDRpAmbAroAm+Ib8cFZHwdhXyiTlK7PWXCa1aDZ7TkztzHHrz2YG\nRtWmEmaByC5X+scLQHO0C9S2QtEUmqyQQV91F2Z21mwirW5IJrechrfSNiDt\nvyyhSrKWYvLHpR3egOkTxzUBFLFyKzl/e608o4Hwzlhfoz10fLXCatneDDBw\nT84biZFNSpSj7dxPIdWgmeBu/sI6ODEaDwDMrV7wPUJXvgjs27Nf7TRfwfqk\nuM7+snDG72bHeoN4ltkARDCDwaOoTzS5BSR7hIwi0aFZJl/CBD0dc4m2zTAo\nBAfbITon2O7b67W5TSE37EffjKxI9DrNc62IpIg1QBp2ENmxchdu0LCqxsdl\nhdfGtgUC1ZEuCvl3JQiYfO89dZIA+JKdfTMW6upP5oZA2qx4CA5j2zR8/OSL\n1iDita8RV3tjj+dDdITOxFzrobLnQI0idOh1gqtecRVOC11qNRjZ1bm++tPb\n3F3BN9GkifPVa/BY0+ekqSngTibm01/6vepTYOB+5UeXxup4aXYVMJRz/OWJ\nwl+j\r\n=dHGc\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1538612893058_1538612902545_0.6941039616457676"},"_hasShrinkwrap":false},"1.8.0-next.1538675072506":{"name":"puppeteer","version":"1.8.0-next.1538675072506","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"594312"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"8becb31754e5f6377398dde9bbcc51d8951d7d61","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n \n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1538675072506","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-4QCEnlkjpXnTYrciBLqMLxiDSrVTTQl6P9iqysnTnx7uS+9vpx8vMYo7YLjQ3HUfa7Q8/bUj3Q4faxVuW9BbPg==","shasum":"c291cef895e166618824142bd7b54afc8b1c2c63","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1538675072506.tgz","fileCount":55,"unpackedSize":622558,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbtlGKCRA9TVsSAnZWagAAR3gP/Rly9gToPduWCvHCDBhX\n1iZumAVuydASSNV58V6mmrCZVIMQeGCMbb3Vn9h1MqQisQaRoOPwImok+wOe\nkAC+kB/PhQb6fvbJfyNXovnFTZkZjgkT2lyC65kcSvYpJD3mS73DU9Jl0pkR\nCS2D9LdkaPGndi0UFiDrW8lPCnbHhfcIMD8cZ8kiLCpFbdCkL85slUjEKYp/\nsoi2czwY6Gg8YZ5PyiqIfJAsy959CmEayfXpmJlC91uQKmdfRYAr3rDSiKdf\n14Jov74n6oLTpqHHuPYTNDVCFW+E8k+JYu/8w8Ya1PrB0S6KH4Fb8gWm7JSy\nG40J9IDY3J8ST+aomK3aMG8fZ8uRD3k7Z3KnI/SUfyyTn471VA4/PcbNzv6J\nXdVtDSdj114twnB+0v2InWDMw7Vky4KnrGgSyqrxI7FVeo55M0HUdKNlC5yU\nJK0rhf+1FIXb/nPB9ygVjjr58zRQxUtaB1+4yAffOC1BRkLGzAXvv5cYcFyr\n7JLAkMbVB0Wy6tGg1BIXNwWrBsJAuH8lugiZYv98BiUpjCqQSW0y47w0uCfs\nDvo79uM4hOQlUCsAY3QAHHSYAKYE/Ys8cyuYJ1DLV0fvjirrWlCTLJfKOm5W\nHOfLpyzzT7rudAi6gkXHUTX4folnRv+XNWKlCNaP7MeNzvm2ne8wfOaQ2BFa\nNdF1\r\n=ryB/\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1538675072506_1538675081965_0.45150860712381324"},"_hasShrinkwrap":false},"1.8.0-next.1538688354136":{"name":"puppeteer","version":"1.8.0-next.1538688354136","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"594312"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"4abf7d1fba5ee9013c3e8b9a4fd434b7979f5945","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.8.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.8.0-next.1538688354136","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-lwhsOPpA37VGGYtpYYMGCkjYxGFzmurwgTglaFOKVjT0fnxZB6L7ApEJcgRQg71LqTJsQsAaJBf2655OwzTdAg==","shasum":"b75af20ce0375d96af10c736f2fe383e295623db","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.8.0-next.1538688354136.tgz","fileCount":55,"unpackedSize":622656,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbtoVsCRA9TVsSAnZWagAAufMQAJ592Mow5GHcOH6eoezO\n+hfYkBSSrx/JTeZjpaUiPeS55sfY+QpJ7x8QtSr4xy0hr5wCDPU284kq2UOg\nv/Uv3aNoz9SjYH5MAN+KD/w+2qsJFfZvhULUGySqlWgM+zUCaBNrFNegYp9t\noCgmjkz8P1Yw9a5kbUq7a3U9lDYcF5Z57Y96shjQY9oKweFs4TlGSZeUhAKu\nWpRrnkvgae2pGwNCMvyWIvDtbbur27Mal7xYvpCJE+HTP7mw6eTW5EyWNik4\n6+xr0dMwWN5dPfAPkfaZhbKTjg2mOTWQ8Ds2YQng38T+Nxz1ggT2vm0uJPkc\nvzwPP37uz7lAqticAFaAQZskGc/9dq5eENCsX61QB14RkL9sKpyYZC7Kc01m\n2nT8SZW8LGgzSWU/5//dTyH9Hu75lB2aZ1WlpiFg4gVtwNjoF4cie55Fh+3r\n7phCRStBS798ZSIm5I0nFg5iaRP/f3aAU/ZhuBsFqEYeEdLrbfPpuuFQunci\n4RAf4GSgRoJXMC/tm1rkm6SOz/gtCJgf1R6saUjEd8SgeNHVcH1DA30N5Ph+\nazCqleqqPM/3o+e/SfISvmaf4hkh2pAGtnF8D5ucr2cOXNBrLtLh4QkEnNax\nCqYy+3RlifbIS7ru23JHYq9OoCWHhr4C+iMjWbA+Ea8RgzCH4R1cVrXgVHjX\nLPRW\r\n=aNRw\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.8.0-next.1538688354136_1538688363855_0.40997665893436475"},"_hasShrinkwrap":false},"1.9.0":{"name":"puppeteer","version":"1.9.0","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"594312"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"f6c05e6efd0063930a1bead3cb38b2901d8cbe22","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0","_npmVersion":"6.4.1","_nodeVersion":"10.11.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-GH4PmhJf9wBRAPvtJkEJLAvdNNOofZortmBZSj8cGWYni98GUFqsf66blOEfJbo5B8l0KG5HR2d/W2MejnUrzg==","shasum":"56dba79e7ea4faac807877bee3b23d63291fc59e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0.tgz","fileCount":55,"unpackedSize":622637,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbtoh4CRA9TVsSAnZWagAAcWgQAIM/KsxjlggZxSBKOFXz\nnaD5dsL8J3Wioa+6C/TYyCP8lakWlv/ze9s3wBdsjB0BIz3WQNebv+beJsIf\nvnZlWvSsKiCLQgiv+90Zh2wR/dkcWViWjT5Tq5uKTyN0+HLMFVJp3QgPWR0E\nmwHETisrbJg0XGacq3rJ/sNflU9Nt28jI+qic/cH9ZmdGL2iX1WduPEDViPu\ndg6rH7bNd7CShHtBF4ptdsbOgxzCtc3A16j/yCYmwczo7srs2Yy4QX8HUctx\nY1xIJUmbfy+bd7DRk3FGR/XbCQ1h3jkwN2LDz8J+gA7LAUwKaEQnESahCjv5\nt7KbJyHs+U17H6oQUHoiPND1qOG4PxVwjz+TM8N4Dhc6Mqhe2uSf9Zrty+Om\nrjHlJRm9yeDQGoRsCqIAaRAjC65YKQzFXcjCJPQ5DiMDKZFToCrxvyciJF1F\n5Grb0HPt9LFtbB7Pwgnp4a7OCPmJOaPdwUwG3Hz2vkaREQvc4oa0+8ZppA4+\nDKwts8VLLiOG9QSo2NO9UjzS1ISkeYef7ffKncMBk81SwodbU3g2VPExSCuD\neypmbglvEKvJtlJyq90jm6Qb1SXlEzN08NHTWDUcrtCwtNM+icbs807w95or\nRVmgAYJMZ4oI976rDMU64lnrqt5uhzZwKGrpgOtCFtHIgnMv6ai78dGjcsHM\nftkZ\r\n=cbJ+\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0_1538689143927_0.10929492302768562"},"_hasShrinkwrap":false},"1.9.0-next.1538689231174":{"name":"puppeteer","version":"1.9.0-next.1538689231174","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"594312"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"f6c05e6efd0063930a1bead3cb38b2901d8cbe22","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0-next.1538689231174","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-aMZoLbJP8FiRPYb1vxv5kWgfETcrgneUq0BD397WpVmvAyMbx5ZWIPqCav9+8P6wiUFfexN5J233Ci8f9RTl4w==","shasum":"1f7849d877a47ae4393ebb6e7c758f7260d7ebfa","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0-next.1538689231174.tgz","fileCount":55,"unpackedSize":622656,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbtojZCRA9TVsSAnZWagAA2ScP/jbzxajNirFhdGshyOZ9\nJNpgKAUxMAveFNXDhZ/gzVCsYXHoaf/THyrwGf+PIrTIb7f/gEGVKZdJgQld\nkqMA1yUNF7uuBefC7aVpDdoZ56u9vceyJ7YShZicvSkkyQDxCzU5IHy+aeYz\nTlWx4q9FUaBBr9KOTwrNbXaz+JHOrj5Io1zvO4PdO2WKhlgmjD4xHsHNHK+a\nnZrhucI9rmYnELmNl5Uqd+3zdw/eIv878cBN+Uf6tfmOAFjuZPjSihO0KS2B\nlHaDsHktfQBqcbKNffTZAT4aiB6dTCa6bBE4ovhxrcKPL4LIjm1Yz3GuJ3/7\nyjZHEj0lO/8FMNozF5jzoNMtHEww9dPsJFcO6bsHQ8vFeljTq9kvS0L62/ws\n4usTifJEUNSR+kRPYEpqZMLETGCgQMZtfc7NhaV9cwFxPnSKPEyGeDTWFjGj\nZm9ya88/FPyENB2ug/aqLycLY8fy8g6OkoeRbpLuUEqV1JXmRc4263pivFH4\ni/znW3TZNw7hFXOQCMtJ5L8YoW6hfjUEoH1e/MnFnLhBrTWl1v1+xInqYJf3\nVZj3tPK0EPHFAVyAIyLJQI0A0rq7L1Zf0aVAI0qZfth5X4AJ07knnXHAMQIM\nTx2sozVpiTCn5rErMzKXwfVffP/TUcRdZzvKrRnz7aCM8Ei2G4aZRlgx4T5d\nnLoS\r\n=0IMG\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0-next.1538689231174_1538689240342_0.9069329511985447"},"_hasShrinkwrap":false},"1.9.0-next.1538690157991":{"name":"puppeteer","version":"1.9.0-next.1538690157991","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"594312"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"af4209ff982310ba7f50ecaa1b43f47b14e33d88","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0-next.1538690157991","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-mYKqUefBnOwWgN9lcr7RSeeCkGICd92/q/stOCkno4lV6Vx47/ryDb40GbIb5JWqV/vWJtEJfnWMI6HUpY45Vw==","shasum":"29e08d976bca7674881990aea060276622c881e2","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0-next.1538690157991.tgz","fileCount":55,"unpackedSize":622656,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbtox4CRA9TVsSAnZWagAAb84QAIGUCFXoa1UVU2yzCX5Q\nXTkyEFRoIyXDIQw72TKrgvh1vgRZz172P0H/2kR3IgAw8EoKb+19KU+tFYbj\nZXZd81yk25vtHRsXbTWfwQBCc5bG3GKYWAMlKI9xqcY3vWTDAvkPGcNppEFg\nV3sv02lJzmq613x9dZ7w04ZRmvuBJjbPmD1HMgtg+6dOv3z3KNyy1lRHfKJT\nPTXiLlTHQtKna/0VqCqxQEzt8/25UWjyQm9wSYqzwSawCrMBLB+zakLkZ760\nHoNKyVpUAbedUJC6HtKqSuYrNVpS2xwH6G186gYUhePmgHHlzFxbmKjK1XDz\nxceMhlhUjhQA56YLyhQdv10nkdB2ujjmNTZQOG6atOqdKZRhptOLiRbYLRbz\nVxWNhQwbgen0WHNW4d9bE3e3c1XQxyUKjG4Tw4IYpdIZO4YPjy3naXLMVX9M\nAJk1Lm+e+BCVzY5hKWrynE9h5BAmUJFPnyoeKc21g3xuzZ2fGEB0/OO9na47\n9q5wv+Ibf3JxlZZiEK033D11eSejdOC4HlLPC86uWSEENat5K82qwZ9Qt9T5\nEIRE/8fsK7e7SxJyJqi02V5OIofUsod9JCv+Hw68PIEqkMWGdFH4rwvFpcHs\nbs8sp83QlEvMI6O+pxbjs0m1Q6fdwo1Rg4gybWZ0S4vykFBcWOa/l1d8E+gS\nrK+k\r\n=briL\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0-next.1538690157991_1538690167833_0.9706487717120507"},"_hasShrinkwrap":false},"1.9.0-next.1538694722140":{"name":"puppeteer","version":"1.9.0-next.1538694722140","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"594312"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"90d1fe8f6fce7b0061f3d54cc5966b5094175d58","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0-next.1538694722140","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-H1chHV788nVusoBZ7cmOhM5XWFNNCYqwH89mkput4XNwKuNgjO9HOSUMjexAruw/HdHxVon/ulrBpc17bNBuYg==","shasum":"fcba6245db0531423bdebc316bbc9e5a3dfc7810","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0-next.1538694722140.tgz","fileCount":55,"unpackedSize":622656,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbtp5MCRA9TVsSAnZWagAA0hQQAKAO05lkr/jTHD8X4e6M\nW1EAjzQij7+UDXxnOflH1aQJwfKNm7vminOnGyY6oWW/QC3u8NwGTRbXKa9S\nbRPsXS0NZarzC6A73h5VaHRF+DwZD4SMyxzXvbznuq6jIQw2Jv9tCGDCpD4m\nD0eOPCw4U9OpQokhJynJW/lrAw2NJyuAxVwuUdDYmh7953o6+gdNASooCnOx\ngqFLZPDQQSjp0xcxt0Uk21Ug4ZqQ8kMx4SZL3gKK0UpgaS4GdmGgOL0so7SY\n9z6DhkqXlWDz5Lv618IqfxRqc7jIMgp0lIs6fb8B4mNrlwmlZOkRiqFD9+ZN\npjaKLxHnA83fNacVCehuldXcqGrf6dU/tpRWOyTrwnqPHWcvnx6IF1hCDgbM\nenZJaP7RS/bOosEqiiNDFICg6m+E+JrRGWaI7FEPn5QamEZ7avZ+RQWpGjAN\nWElvpyQbbpCI7suYu0pEUv05jKxuVMrAidLvhqVn2TorJKhTWZ6s+TiLzV1M\noDhJAjeo7MsX9t9Zkbo8hQAoclJSFpkeVdsDpPp+7S9jkCcO9LRExNktqbWN\njm16CAcOTNxnx8e0sETztJCOKnuY/63tvnR5Rt1N0UmZ/9rEU/LpSKLZJV9s\nj5Y0jJk7zXKA14T7jPmJXadtnm2L7l68z2QWQY267LQTOjQjjXQhiBfTzwC9\nETUo\r\n=F+Ar\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0-next.1538694722140_1538694731606_0.8359433306782738"},"_hasShrinkwrap":false},"1.9.0-next.1538768278224":{"name":"puppeteer","version":"1.9.0-next.1538768278224","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"594312"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"07febb637c78cd59e22a15166f816d838a36e614","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0-next.1538768278224","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-dLd4cJkve16zemikIR0xeJJPmXdDOyt+Hk6EcA6hMwfJGKRBJJt9RVTT2QPs0kKBx0HyKtqa1oH//ggC3qEegA==","shasum":"63cd2c38eeefcfdf64f73483698da9e0555a486e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0-next.1538768278224.tgz","fileCount":55,"unpackedSize":622836,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbt72gCRA9TVsSAnZWagAA7EIP/0K1w6xNpO6sbTZ6anq8\ntzctXsiciuK7Ol9rZlHbKQRffGBEN4LTa5GT0SFysypcvdmj99rCI8ZMx8xs\nvgBNzDeDFKvg9SgIXuTrhZFe5XuFOoC0y1txxa+urfBsFDQXnMtDZt0veoBa\n+aqe/Ag95UeeHC0diJU7ab4vbzJFnfZMbvbzvtYSlshkyDgMTK5cyabjieNz\n7MC4obBOzY4wO4a6Gabc+Q18jTx3tboCHQid2O4Etcel3UX/Rmqrv/SjPRdY\nTwh62DporfF0dKDSBT6gxUciIjrf/TQYS9ITfuJ/RL953XrJpXW9wRKkiUxL\nIt+4YZupUHpT6OFz+h16+1YA3p5TBlVme2G/dKvq5xDsKIqmUaMyxJXdHy45\nAm/4R16lhv1omaTKm2s2TbGHxBd/WJ6fkKXh9DIXo4LY/HfZxYwzbGqoQwhj\n/mDXBDS8qh63zj2zZXw303XG6cbMk0I2mfPWkG5nKr2+42lZYpNRUUZu/ln/\ngKbJKZE8FkEZ5cEyf5XJM9k6WtaojEFxX04Zr8HO6oqulmiZVFh+w0CblQYe\nKY3nlvHYIKfoZ0GzYMWe6n2Nqrk3gTTJePSrwtfYxh7tYxOZZ8xAsEWqoMpM\n+7AaBzAvwV63LbqO/M6qSR8iLTRhh1wzNdDpTOE2HBxxxzxrhzMcdXypsMJA\nMiAm\r\n=btTp\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0-next.1538768278224_1538768287750_0.9469586019598204"},"_hasShrinkwrap":false},"1.9.0-next.1539120044247":{"name":"puppeteer","version":"1.9.0-next.1539120044247","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"594312"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"6ac66c3547fdd95fed97fc90b15ac0b4bf178a86","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA and generate pre-rendered content (i.e. \"SSR\").\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0-next.1539120044247","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-g4c6l4OkVMjLcYCC02mxUR4lH4fCKTs+gWTcDPE6L8N2Ts58DSy2V9ZA8D+RahUjP5hnXMMI7rJLu2x3YPsGPg==","shasum":"729cdbfa6473afd7f04ab886ef847d9beb200e98","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0-next.1539120044247.tgz","fileCount":55,"unpackedSize":627632,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbvRu2CRA9TVsSAnZWagAAzJgP/AlpHisVpkBkx8tuWgAa\nkSzTwDHujZBT3VxfzbpHtxV07GgwOi91oAyrqkLxFZQJU+7igDxDwpQpRZGJ\nF2skFKsYKqII2wSKb6M6Ser8fWjix+rsyF1k9DotK49HitAjJypBgOlSqbHx\nL1QYsqOCSx8UpOmR6BZLOTX4sc5Bynf4x146wY1kICs8Gk3jyGYfemBf1/lZ\nTGYMWEs0sb1ExRpBXGN/6bxxp/abFkiqs+ycxG43fAWePVBjOWquiz7yGRhF\nrzRmH+jHlBzAeBGZwMXDOjHpV6gHsS+CPJjeYP1VkIVYAUyOaPxHeqXls6QI\n1zJhcjySZ63OUprhS+aZJvyDY9tGPu6HLB2/CoKjPgh0iDg2IkTR1SaRjg+L\nwde2mdwAyi3MhG+PLV9E/DuAF7Zxq9fo9Cq9qjjw+lMtAc6QoSf4n/EKgNSP\nDmBX6xplHUZMF9eIi2tTE2J7hV49mgniWHMj4ce8pe7tY5jj/dfrioDpJzgp\n93rAYa2JtcVt9+BRMcCoi+Vgg3AYPnsvOI8LzK+1NAceqp2JeCuZqK8+zZ2l\nOjY+TzfK8aEo6IE5cRBhKZHjm0q9euCEiP0Gr3GGdZ/TAGHltk3+r4v3LI3X\n09o+Bh5C+CKYmtPvrZdm/Xhz+TavrevBmhAu6gCDZ4iYF2oe74yArvZtj56A\nqz7l\r\n=q9vg\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0-next.1539120044247_1539120053856_0.14289672639891138"},"_hasShrinkwrap":false},"1.9.0-next.1539120211700":{"name":"puppeteer","version":"1.9.0-next.1539120211700","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"594312"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"0bb462c8f59071dd9dd6f5a854a3497f2f5497a8","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0-next.1539120211700","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-0N1yHAM9NtTJsV9ruG4EGeTiv+Y95kUr3UJq+olUXweW9UHMk/nwOR+6GZmn5ump3XhsZdllp0Qmm0kinG1Bbg==","shasum":"f59471f8511c33ce11c61a23d2e1f4c38d98f6b1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0-next.1539120211700.tgz","fileCount":55,"unpackedSize":627682,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbvRxeCRA9TVsSAnZWagAA9H0P/2rI9ff+S//gB05xzPSF\nMbgfS1kkmH3z8vYIOpU8RA3uS/4JwWg6QWd4GNWrnMZ7dq5AITY9THmQww3T\nIF0ZTtrin52QVd31aP6mzJfFWw6CNFaiElWI1KzK3iFw3W/v6Ze5OyOEImze\nrmtXN3tirSufV89XF25ROM8JyLvnp9KyyFb03dYofenB4J8DydzYvNvpkjBu\nfFOQXrc1hZRRke7H696f5zJ8wxAD8wYh40ofhsd3JGiDvFNkIfT0PFvTxUuG\nlttWxPYgrw9yuX7o/YUCP+c3VFFdX7ZhICekxVItJJx5rXNVZyV7cKbuT1Wj\nGbnxXP0Iusgjs2zMPmQDaABLlUCRaG0U9EziS32qBlnL3W89YDU1JCYrUHH3\nAs69+5/6NTMzPSdoauJ5RrlYI9j9yFYh+4rkLKy5rRTPMgwh9vZ9VhVNa+j7\n5mmXI5WpZ0jFrr6FHX3oEysOxx9N3FDxWaLz4hJuIxB/9Hdeanolq1srgqSp\n4Nxgv7+L2vuJDaWiTXbRVx7NWIuFsqquQyMMaIDoFuMW4O2DBnmdBVkA6LLy\nOsKgY1FGHJOkb8f7xT1EV5uKyIyA28ycoktPD6kx9RUsyGn7khkJw5F6cg3P\nJWk9fzC184J+29sgTbFNWZ8p8sRTmMov+J6UiHVEmUdpa3pN+GkmDBwQwgkl\n8BAH\r\n=CGQc\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0-next.1539120211700_1539120221885_0.9159277842408953"},"_hasShrinkwrap":false},"1.9.0-next.1539120534494":{"name":"puppeteer","version":"1.9.0-next.1539120534494","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"594312"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"a04dedcaf831b69a7e375bf4442d91ba06bb20a1","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0-next.1539120534494","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-5T1KnNgoZsz8BpFfI03fQQE5CtlP17jWu4csvxl/KKjk1VDPgcJxuGZUyztaahuhuQj17E1WESuPaEfgsxKXKQ==","shasum":"c2753c686fb02e5b6fec2f13ff4998c81d3f5aba","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0-next.1539120534494.tgz","fileCount":55,"unpackedSize":627682,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbvR2hCRA9TVsSAnZWagAAQ/8P/iJUCjbopsbtvva9HQHu\nYd5OufYIH16R0wYyk1AkkHXMirdCfY0MY7Sp9UA1b0pNAexHxHDuAFFHeZhy\nDiDjp9tIRdjIe+u86zH0vogMIcj3RUocbT+uOvMp/dHX21KYmj9w1q1fvU4h\naMZAMv/0RjcoSCJftK0kWnDCZAl6+EjPTtdagvB3wb3+SOj+jFLKUf+vtAbY\nxJpGeJ1j6hSrewcfXsqG48c9ynhhZ2Eq0MHxqKyGIWW8h9xzgrbtASp6BSLC\nEMi8k9KcuZ9KUxgikY/ySTAT+41rRYR4WsOVX1xeeBPQCI7aGSbHuxuieW3t\nB2WO/kb/DuoyPh0DOveXsvM2ujZWaNNExBDzYuE5urObKT1EXbIGrTd+bEOA\nFkzI7VJnIxohILyevNqDujHyawg0TWgZZWrprOoz3DjLxNFDT1fWu3s8a0Wt\ncuIoF/eDJAO1z4LRKHme3xaefXdXW5yhNRLo+d4+W89A9Nxh4S+ytv5V+MKf\noW+LjxK3M59wTy8rA/ca3GrnUhXio0KW3Dq4LB+jaVXGBZ2KUg2eRiNXOeWy\nyy0hb+mNbX3P57nq+sjK4Ita0T4ttTMkUTWMU5oVq5tRLFx7NCtB0RrrH7/Z\nrPCS7JQSPj1PHmZtHRKy+OTUc09kemqV8q728sN9zIoq4WzX5E5dL2eHAF7e\nFsKF\r\n=X80L\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0-next.1539120534494_1539120544256_0.14464197526819644"},"_hasShrinkwrap":false},"1.9.0-next.1539377578495":{"name":"puppeteer","version":"1.9.0-next.1539377578495","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"594312"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"0fd3bfb986f1673e1665a3f5fcc70b5f1900fa32","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0-next.1539377578495","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-bLCXbxuvBNt8xbk1zyWpJS3XX7xHvMQbEHLm6/qvwGkNxK/DZtwtvus7qLHBvfD8zObjgLMxpq8IO4m66SAyzw==","shasum":"eb10d2beea58e93ccdef14146d4fd8d3dd2b310f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0-next.1539377578495.tgz","fileCount":55,"unpackedSize":627682,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbwQm1CRA9TVsSAnZWagAATGYQAJMz+VSJ5gsW94rTuT8n\n5HDlD1NyNOW+3jDfKzKfXPx6Ufd2xHokxA9GQlOF9T1tM/qHLjosrLMVLpkN\nFjvLTcFpchWuavFcfTzWbWPSRjTy/BWYOzo2bmm3F4dzoG+Az0B1noPFpS1g\nGsSdJc4h625XW0RW3U3+Qhk6OtteDLJOWhp2GpKs1xD1sRsuitl9zYOT1ASq\nxCOHl3SnmC7LOC3xdeJ3LMxmGyrJkTZhAv6tpFoQlKExOU1/nDZdiNBVR3ZJ\nFQguvY3CFymlm/IlrV86CSs2vI9Lds0+ZuW1G6ez/iz96bswZVYQJvsgv5vD\nsomk4RGdxojKgmljDU0B8n0uBh/qlA5AA77AHHKK2RGOZ2cxtjIVxk3MrBLg\nOZ4+zRV89XzHKnRXp/R3SjvhK9bBlD1XXgAEvdECYMtuUyMrtpMF8t6rXrvG\nSrYwO9sGT3PgeY3pomYpxq83OmtRRuBGD5vZqWl+XKyYQOILIB9Nn9DIAjoo\nQh1V5XjXTO2Zx11xQ5Y5XekdSS1werOdJIOWIIshcuMrDREb1FovH6dSBc3L\nvWmwwC5p1AryivXp/KOBOL1kTZzTGLa4bmfeZq6H6GyiabnmoQq27jVblJsS\n66zaLAVVb1/QGE5yVo8zeZWnWI8KA+6BUysbBptOU+zq6H/HHORVMc5DV15I\nVGlx\r\n=FgvM\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0-next.1539377578495_1539377588482_0.9125150761791652"},"_hasShrinkwrap":false},"1.9.0-next.1539714521728":{"name":"puppeteer","version":"1.9.0-next.1539714521728","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"599821"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"a4cebd8e6aa2881eecaa67603defd73ccd7645ad","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0-next.1539714521728","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-66s2D6Jy0R47taaphbqTGZSwNWJQ27K3Ivud0DzPH6ZsaMmgJopHhK/GRAcxx4oLKAPyGCT3tACIsWxDuXfA8A==","shasum":"bcb3bcda902adc4bb16b0f3b2190e7ed70366090","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0-next.1539714521728.tgz","fileCount":55,"unpackedSize":627682,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbxi3kCRA9TVsSAnZWagAA9esQAItHtCHABfnaJJWh4mk/\n4J2lBnLUhBupGTodaiuDxOUp+x4t+7QbgepmrlIpfiHdwptWwieWE0R6j62r\nUTbi6j2OJe/Oa4rGE7DvTaJxakqegmy3Zz+zO2UFy9u/SbpP+/Dz3T4ADS62\nCwDmBxOvVHNg9T/t9TTkaGWAwm4yRytSL06YSGoPKz+ljP7MJ9zJTPyY3ea9\nk+jRjWx1geWf3vPIZg6b3NMqxkZXZAtTexsf7/YZKuXuixbqNH8qQk9VjL52\niVZq8xBRU4JgAJvQIEw+/uuZIKuwUUFKYYUOif0BWyyY4aoOkKcP+MJBKLpo\n12kzaMESAsXZ8RguiqtikT5Pawtj0wOwQdJRJbno8xpj8rvb7pvceE2B8fxs\npIjw1lOkU+CxLVOejJjAdoNMIPMHlVAyH+KO1Sng8OUwwSxghzFepDgDhmFG\nlVesbWzObqK71XuUC3h0PBAt3zRU+NJUhid90SGACIvL/3xOK1567chNMDj0\n3Ub1iganFvrsAfaA0Y3lmbOZJKEypdeOpPE88Xh25d+Iughz0evvnzBTNH1W\n7hjFqRS2iefLvnhKy2LmQONp8VMq/7/vHU95LLtV1JbPpxJwh13VNhWvvMzP\nczUMsf6ZA2u6gdb7eOfZZI2x6WHQys8oSZJ0XjTS6LK3+IPejmJWkGElNLw8\nwqdY\r\n=HJT2\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0-next.1539714521728_1539714532176_0.7314253534980018"},"_hasShrinkwrap":false},"1.9.0-next.1539734295322":{"name":"puppeteer","version":"1.9.0-next.1539734295322","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"599821"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"d025d1f959ef5193e1faae61244b87b5cd8850c3","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0-next.1539734295322","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-KdB5k9JJ3tfskTW3jUAJJRQ4V/IcwGEdJStWiEKaJsJBqY9gnbKf+IvufwlHUA0seDoOdHGaUuLy9/IU6UbfBQ==","shasum":"22264fa6d8bc2cc181d8673e4feb00c619514170","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0-next.1539734295322.tgz","fileCount":55,"unpackedSize":627688,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbxnshCRA9TVsSAnZWagAA3gsP/1U9YJM6tTS1JIrbcEJR\nAIVmjrVcOZGldtElW5iKQhotzN2F5js0UCM8159ucVbIHG29fRwq0OBTdRdm\n/wT2gSDiZ8QGNS8b6VFJ7MT7oNjs0AkZlzktwRPGaqdrJOX2HxPn0KjGtpXU\n5lMDosXwKmuLO+CJupG0pM2GpIyURVTRt1gnsVHHFmsdTCx0wKVdtgebkiAp\nRYcoBZtpJ09kNcLihpo4IWyUDFSiGtOJDvPvnzoZiaeBDinsaIm2rmZQjTie\nF6/SQPXF+dTSGGulOeROEanb3w5c1Q9tYuLizCrfHkb63/tsm64MpeEZYQWr\nBuQF4szXFDUAxludjMZari2lbYM5KkFjDATyR3Oh76Z5Veq/S6lBBWmJlcvz\n34RhbYe00lJbDKpDlR/gx1qUh3/aZiINqEoVcLbzqEgB8J5/hDJW+UYLsy2Q\nTzBHrI/BhSW3fhvgEoZD37cfE+sU6AiZdgWUPsVIxc3rldo0ur/uyRAxOTCc\nb7NJFCKywUbPz4h/f7vLXEbpvVIU2rLnKwOMAANLx0SZOVyg8es7ZZFw7gKw\n3y2Oa6gj46glskV/ZapwQkWvAOOB9r6XA55PuMBbmut3n/WhaD4y1jgg8bY5\n9yAFbH84YweyRnJ1uSt1mliui5iKItwCf+ffRjvfNKTkukL0aMQ0HlKHcPKL\nZxe4\r\n=+1J/\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0-next.1539734295322_1539734304999_0.9452367848130145"},"_hasShrinkwrap":false},"1.9.0-next.1539736052365":{"name":"puppeteer","version":"1.9.0-next.1539736052365","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"599821"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"cf8c62e835b565feb9d19639a3832a59d9b07aca","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0-next.1539736052365","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-meF6WR6FPYRM/qRcyXe38kpS9ftuWy+Csh6/HNkwf7OYTMFZavLcNt6p034qTSJenATBg94HF2eF3tHpIJiCww==","shasum":"ca2233eb12c2d8de189d634ac66cda73fa1cffc5","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0-next.1539736052365.tgz","fileCount":55,"unpackedSize":627688,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbxoH+CRA9TVsSAnZWagAA2BAQAI849/a9WlGbCyfpQvwg\npatrrh0y9PWkV9RHtPNkT9yp5dDI8MydluAMbARuaTOY3piy07AHxaMfL0Y5\nJV094J5bkj7JprvALKz4XBqcYOebtmds6K+eb4+xv8Gd/udq4y7Wi8p0uq73\n72z5Dl7Uo9RznVMHniysTmlFtZ9jLKguJewjWp1bR+bMO3yvKWokA6kDNLlD\nXBy2t+8rr5I4xQpSYD9CLQ20vhUcNX1g+q8sHl+zuLfjyZXogQE/JTS+yptB\nmXBxFpQADPu8s0+KJvkmSdExiGTbdpbzAjGGrJRUAi2/yqiZhkIGqzq54keP\n1tircav19CM5DcX/cmRzGdS80aTADjXFdKBFHphwWuWs5j+qO0bP7ahQJ2zn\nfP0qwmPDMrCgLBvPMOB8Q5H+GZYlWgkkY60bCgF16AA8YUFncZ2QBrBuF4I4\nhCi/GdmMqzV1DJGL/DzoVJ8tY5IWmvgVf5yLF7Vi6aVktFxySR1jSwgaSMnx\nh/o9a3MCAIknGBft2NKUWuVLCXDClZGQlgML0ps6YmdLMz7AsGUS4F4+wxZX\n00Fx5F2xG93qIQHCeGjWCih/di4qNS4sez5cst+WTR23la6TgBCzpaXYy9JC\nZCIVa46NsVFw8gUzjVCiZCt/EJ0CPMYXSujXgSb/mkUvcrb1Mm7uo72dpIPm\nmIFe\r\n=YUd0\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0-next.1539736052365_1539736061832_0.7013705472125298"},"_hasShrinkwrap":false},"1.9.0-next.1540492188882":{"name":"puppeteer","version":"1.9.0-next.1540492188882","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"599821"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"fae441cd42fc410115ce9cec40563e21260db9b6","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0-next.1540492188882","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-hmMgwoUQQDNuzLx9gbN1oZrNKiP12MyPYf4FBUHhQoCPZX+83IuG99I/2lv7Tq7NqrNCfgaZovZ00mfEDQGzhw==","shasum":"024f3238c349c37a347f9fe17d1f583a968bc33c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0-next.1540492188882.tgz","fileCount":55,"unpackedSize":627688,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb0gumCRA9TVsSAnZWagAAEscP/RkQLQHgcp9BkWkkmSbV\nLOa3Vyl6TAs5VNhkcqzbY/us0iQMbul8xu06pRmki4GowrvhBY1XiwczKxH8\n3oCh4fWi8BYasPl1j0qyoxz1Cna0jGqPXUWJerqzTcXl7NN7D+sqzxZYHgSl\n0Eyv8jfqGF9CyfYutPJZnW7E21PIXHueVy6GsJRmydaRtCvdw1PwJNKmCtRP\nsWc2WB+ACeJbrtFPwSN5qHikwRX3J1ydeB6bBYAuLTh6tEC2u5ko2uLTpIMk\nBU8nIQNUVY/0SShtNvfaSFjYFqpPEWVpGqLmeBPmRu0VRUlyPAQEJ3wAWfwx\n4I4lMmjjwC7ELyX41vdOL21UqHacQ0ikRh3cJqHqceEw7cPKCbD1BoMJLLU/\nIXPCNHj7I222VYW3TFgz6a550cwME+JaCnuaEF4ZBCQzuRMuzig5Un8W6eJA\nB6YyWnmf9HVlzUyYx8Oax/trDnxd0byaWRxeCghTgoTo1ZDkEY+yZ00ZO1LI\nkRgAEh1iCu4eR0JwZBhVUfW2F+Whd6OfvhSZ6nJs49XQyRggTlLlZcbWR08o\nhxC+SzgShJsm3bhijW8R7pKTcFrBQj/TLsQF1WKGa3yA55onzx4AjyVsd8Y9\nLlGFanLr/qmgc/ZcOCB9EddQvOG1jYBoAL+Nxypmx1PYrcz5xwH5PpRGQgoQ\nIvqT\r\n=Cw8r\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0-next.1540492188882_1540492198108_0.24074705269724173"},"_hasShrinkwrap":false},"1.9.0-next.1540493070953":{"name":"puppeteer","version":"1.9.0-next.1540493070953","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"599821"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"81edbbb58e5b572a9317928b9ca90efd8259f87a","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0-next.1540493070953","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-kDyv+GxYuvoKB9TYwVDR24kBwbYALl3V6egiYAnPEMpylmctova7dEooIlCo+4QOwExQzVn5/xZQhr86SqcOvA==","shasum":"98540b6a3edd69866e0e84c9c268b1311d03d54a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0-next.1540493070953.tgz","fileCount":55,"unpackedSize":627708,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb0g8aCRA9TVsSAnZWagAAPvcP/0B85Q8adCRbGzJuLkqQ\ny9L/81+Iwa5Qnuh7dfUs76W4Fsp4xLhnmeN6SmtKGsm92DxwV1DmMh5P3aLF\nLtO/HdzDWeza886cIrjsz5lr1NAbZQKGjWHfeeTHWfPFZOhP7lj3f0mO+I8j\nCSF4Y0vLdSclyAJ7uuDQb5YPQz/H5PaBKNQ5bMWw0kuZgqPhATGVWAPZ3MUr\nfOTZ8lX7t6XjDCL7GITJCiEGsxO5jPGZtfb/u3fVrMUTSZr5dqd/RMv35+ED\nXO0ozV//yOcUOCIu3uibneoAznR8sORbBbvw2+KXppuOKQhhYxqyroBIVtns\nBGoCJBZa8iqvyVfey6+oF8wJ2dVpFE4RinR7ARM4uK63snORMajFZPwbsUF8\nqrPl090V/WWgeUOfkhPrcb8GtqwiJ7hVJCkFPU7uqiQ32ykcPTmlI5ThCjp4\nf0CnB1jd0Rp9Xn4Lg8D6j96NFgWpOu7wfcv4z9SwdYcZHsk0CrgSyOxdtUkx\nD0dV2K+iKBexFZYUMU28kNj/JfGaszoQhgF59IJ7saip8n5w3H9/2reTYiI8\nbs/9kY1lmhOxMuL0m82idPktVBnPewYQbOBBO51K942CwJCoiVgHcZUahz+K\nn628+kxH+YxuF5qgtWOUiCk9DkNyXc0C4UGtSBViR+fWuiwujeXx9t87d0WH\nZaib\r\n=79ur\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0-next.1540493070953_1540493081585_0.1832746532570526"},"_hasShrinkwrap":false},"1.9.0-next.1540604446651":{"name":"puppeteer","version":"1.9.0-next.1540604446651","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"599821"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"9800b2c3c2d31379badb9d4dab1cc8fc95aee48a","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0-next.1540604446651","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-85Tlyje+Ad+jAXpqz+TlvwAOCxPyu0Sy1J7Y8j8g/y1hmAd9HSGDIWRH4p4BX2pSwVrjuKfFYgw1gk/wSHCGtQ==","shasum":"377fba0c5359f7dbac88890ab984c9a0d402863e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0-next.1540604446651.tgz","fileCount":55,"unpackedSize":627708,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb08IpCRA9TVsSAnZWagAA++sP/jrNQzBlACO3KlTLHtU4\nqtOpp6zIH3+iGZA+CY0Pa+uy2SLIyrm6Hw9SsN//6EONkWFiqSzW6mE7qn/2\n28rsVgRQ9dulYv5FBYKx4rIa1OOG7Y3oqo3STfdFGtTkKtqjRbd1PfFogCLD\nFnQj9L6yqS0fuk9g20AOQYXpmTh3uQh9u7ugunVp6carlbpxLXRrVsG1kfrJ\nP7/jQMgTXhfLIMG8bTxQrMjNuuf++0nzyU1LJNDZxZehxQbR9bvVDpURqaqG\nd7G9vxkph6C/LUti0QBrpsAAW3S2+PdgdPx+SssEmn46TKPw8vmFyxK1/jQk\nSro1jADuk521ddkR4s/fF2junWhJHKgNYY6vg3v3IroceOVkHTJGwtmv2rQt\nsjTLd3QJm5TGrIYx7e9hv2AyoGk0l2/jhRWgdAxTT0ZFgJxF5presHRGYgZm\nyQmK4KnfPFs6J9tAKXJST6k0OYdT2yoGtyWgWEB6tVuBP4eVoGYfIvAgnUab\nLiprdXR4OwqzDL7WLjfwKRgGt6cXS8cRmHEyHyzG+EoxfN+5gOtC2uAM/7b3\nMQlk2jIE/LlPQ4lft4wMABbozeoS1LwiFJ+ofpVDMPh06AMzLxH5vAkq5wL7\nOyk6kwf1l6PTjyjc5jVzu0whCAVeNE0uzaG/pua5EXfT3Vk6/K2LqMcGNika\nA1ki\r\n=MEeE\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0-next.1540604446651_1540604456953_0.370398439855788"},"_hasShrinkwrap":false},"1.9.0-next.1541028853238":{"name":"puppeteer","version":"1.9.0-next.1541028853238","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"599821"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"3dd5c28f90a9e939489c0541c5aa520564fae280","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0-next.1541028853238","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-ppaVmPbmQGiypTDvczAAjZ2DhGMVYS6VhUxI8fNvEl/Z340nenMKusTWCKhxbfX+IQff8e4gl+xZ9twj9uD9Zw==","shasum":"af1e7e7d9280541bd310d4fc5fa33eaa341dd789","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0-next.1541028853238.tgz","fileCount":55,"unpackedSize":627964,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb2jv/CRA9TVsSAnZWagAAnlgQAIkq2rH4WynsNSJIOx1w\nPabGiv5S932y+EiUwrv5rF6aUSY5xP0PwXItXpHdZkSTyU4DQRzg40sbsP1b\nQbc+6tm391fkQ5CRx7OGK5JzqUxj80Ht9hJnnQhR/VTZsRNzBoy7ZpzZfgM4\nksBsGSySOXAQdpWnDp9F4WiETD0b/Wwg/Y6LJw89USvjbrxxX5SxeMNsB4Kt\nvJaQpD1mF2fDqmDSxJbIzWROLXtRyu9MAQd0QSs4UX/uObKWs2tdw5I4mqkC\nFPGJx4O1nKemZMjySGoRfUaREoMilYb1s5i2NZsLnqul2Mx1FhxWA596ahmT\nbvl1UCQWqxibZo7notm3ZW7HkEz1Zqcc3A/5ayH1yPInq0nd4Q3kSXHXRIxz\nEKBkPGcQ3r5KF3xfs75WfGxYFAeQLayFAmfJfRVjXDcVGxpNW+1toAv07sVP\nZvUpe1si7G1UbuA0DKqUmOYDR7g3xgf5gA+tUec7vUU5/N1INeV4721BkHrr\nJa0iv5Dt7YFFWqcJEbeMu+vB0ze6XTxHi2nHZ3wMqWNgYvS7zQN3YgBpwrnG\nl3VZ8fJPJf1DBgBoSmyWSC0S7Jp+FNlhZBmOT49UW2h7Qp3zycL0sKB9Cd5Z\nIU8m4jDeHr423K6+aXemWRAQn89VBmy596jD6s+S5JlxFoqYJC0LlforlVaX\nIUcc\r\n=dz1f\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0-next.1541028853238_1541028862389_0.08575678861328528"},"_hasShrinkwrap":false},"1.9.0-next.1541112234493":{"name":"puppeteer","version":"1.9.0-next.1541112234493","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"599821"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"2a88690582cf01c8a338a972b352c34738e6bfdf","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0-next.1541112234493","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-GdEJ4UyrRRd8zaDeqeo9ePUSO/woUj/NHY+ai4d8McScveeRExTe19qjx6M0l2PUwXPOhWcaJWg9+OZYzjR2jA==","shasum":"970707586b6c55a051f0f783781049b66ba48e0a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0-next.1541112234493.tgz","fileCount":55,"unpackedSize":628210,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb24G1CRA9TVsSAnZWagAA3XwP/A7NZES3vpGOiI6pt8Wy\ns3adT/7GSEDKI5JkQovAOanWQIuZ+07KLpi3jtsKfqAp2N7pykAs2gYrZB+U\nI6yPSt0MIAmIAisD0j7GBu3b8qcoDajdpn2gtT1iIWIxOl4lz/MYUXxIARyL\nb193Q41MRASCITwAWhMCrd0XFb0WXPpegOtGgYi2uRK2+7SMuazc9gTntfiT\nWBDkYY9Lbhls913euslbe2KNFDKoWz5cvZbZiujl2RavoZgz6PccQ5hemFdx\n8kX+VrILpSSwojwxU4Eh0b99qYoOAw0SlgoykGEPrm9g0n6xlyQz9VpYHoHA\nlj/9gr3gsrWxCusa9tLxe50SmBtWqPyV/lQBVQWmfL25mojFTJ0tUZkn1ZGx\nH/ZSAFhTI8fZac62KkuUEkOsz9fjxvMUAAOjupbnO+0F2OJS2qH3Kqey6Jav\nJjyNZJDY31paynhM4ceXIjaI4eH5EplKSrqZG10MwZuxk2wdj1Bf7Z8AAgt1\n1jJBKTJ3WEp/9dmECVL5I1GhsvXncKW3X2x8fPuEjs/DOykO/q3h9SXapq3V\nvJMNTsYKEBFWTcQ7p77akd1ox/SDCHWjLe3yNxdueCzjR2qeFF9TQlNIHFrK\nlRR/+h3lZD/enwC9r0Ra5VKI2mJ/7viqOZx6blPoBoQdSIZequeOqJhI7sPa\n4D/U\r\n=gIVU\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0-next.1541112234493_1541112244462_0.9022832602374105"},"_hasShrinkwrap":false},"1.9.0-next.1541112473441":{"name":"puppeteer","version":"1.9.0-next.1541112473441","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"599821"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"4110087a601ce2c37fc441e7cfa0012538d9c5d1","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0-next.1541112473441","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-F1KWbhvwYa2LqLDzoBtiakKTaENeugIOAakdS84GKAQ7178Hk843FBmDTML9Ln+SYw5gPaOhrxSitKlIv7lYQA==","shasum":"e7d96c388e6553e2e40b81cab816c70ece238728","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0-next.1541112473441.tgz","fileCount":55,"unpackedSize":628210,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb24KjCRA9TVsSAnZWagAAdtgP+weoQsoZBVHqbuvWV6NG\nzp7BEaQ+9mHHJcAHiexUWrtQjkSmug9E+t2c8LmAqXeDzTFXXRZyPwRjq9p5\nGPP+wKOTZJvOh32IZ5HQ19PyviplnaF6AbkEhrANjMFS6Sje1sMx+5/t1A52\n5yGuXTbBzy0CjeWRbvFdqXpgi2aQ4yLjen2DLHqNWwYHFIPYge1shr831Yyb\nUd1WtHcVAgDn4mVh9TXqFHD+bxJeuspfFLfUAa4CpfmHF8APmiYKaQv2eA4b\nNa2nowG4XN6yhiu/TWkSJMA51OFzNbcQ64xp4vwaLBQ2FlYNTmMxQfLS0i9i\nY2vAKa/AQiRzLKJwMnQmTXTBcagVpIl4QbuWnl+mUHGIdIUb8tE9fCwxGmWi\nPmhwdKdAh/6/hA0Fo9vSI/s3skMHp2zbJgpQHmuWETaDMOmAw1eURrzIQfQ2\n7IIDTnVnNQHK69B9fFuWcMN0hn4JLOsdLa8JJRJRtz1WiE+y1zwq2BBWR8WY\nZO82y0O9hoR2zcL+0GWbo1zf8CaIBTCydqMv0v++/W4jk4F+fwxEIQKDpvdq\nYkrLfsN4r7ZFga/bVCAW3CU3UoaLnwk6e6je19pVjGSealawdn1vT5cx3biW\n7FDDFFc2W212oWj8k0ia49kJyUhvbKzPOoNJnhABuTrER5jsI9ABHxisAL2d\nYxYw\r\n=lmTn\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0-next.1541112473441_1541112483168_0.9193990293917791"},"_hasShrinkwrap":false},"1.9.0-next.1541115972867":{"name":"puppeteer","version":"1.9.0-next.1541115972867","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"599821"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"3596c5f7e2686de355249b23b26615d9a11f6e5f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0-next.1541115972867","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-j2iduFTi1vapKojcJnpdm2YD3h2yMEXzCPsBE0deUXjp6J0QZ4j5sfxoAzs7udw/Iic1VjYQdx6a3bFHsRdNxg==","shasum":"b3d53ac908ef467e5d4e2268a9b96e6a2ea15be1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0-next.1541115972867.tgz","fileCount":55,"unpackedSize":629502,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb25BPCRA9TVsSAnZWagAA8G0P/RAlMUU1lnhjfFMsVHSp\nMfkzJec+oEs+YPgKcEf33fWr7CmhVCnls2PKFptZXkdeiLHBa7kd80PrUvk9\nomTUdt2VU+tDafXrePgknMbsOA9AsQdaUMY9Q1URPhSbdXdN4fmfmdwx/beT\nLTqnGeGq6Xmxzs+ol2eJhN8OELIFIXPIFhXUBytJA3iqjoK33VcYRS617U19\nRdwcPi2O9JbH6k7gLEqT/zGgdw+q1dCAHgVF6LzZQwh+3sLs0f0aCvQKZfU2\npSaV15DD3KjohzPqMATWPFVk985JrS65wW7MCwrkJ1xqTyZ9aC0bgqyFU2To\nG2kk88ZYwtimlEveeO3e9Xg46aAmakKLfBv80qXP5BydYfBEJjtSMGcBp8zK\nmZyDtZQurkJJjiO3G/cV1YouIZilapdH2IRJ7EskU9StkM1aVaKCHsITeHtO\nLz6fdhZ5HEv80+0QbupGS+M5ywgsak67545l5s6UAreJJS8ZzquJqHGtROBD\nuXKtZHt8jrnujEedYSADqeNyTCr3thk4Qsb1ZDAFxutXOUVJz+LWz+IUeRkH\nwHqb83k16AvPTD0zGzpCCWykZudEklS66HGLVaQve1eXd9539PQ9629bEg3n\nMnuHGKVmJER0clxknynp8Id9qU5XfBlcBW86xoiIrHSABSrdC6ppjrZR9o/O\nueqI\r\n=NI+P\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0-next.1541115972867_1541115982736_0.6534294574760797"},"_hasShrinkwrap":false},"1.9.0-next.1541123853272":{"name":"puppeteer","version":"1.9.0-next.1541123853272","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"599821"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"9ba3261571f3cb636f83cfd367f8ceea7e6e3588","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.9.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.9.0-next.1541123853272","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-TTKnPCTM7SZcDJfUKWK8Id3zg67mytnM+O/boR3u8G/b7I1NQ0bkuUxCDY10MGZu3Qwh6pyENLrqPy9qObJA+w==","shasum":"01757f50892a01374a2223dbce828d21cdca63f9","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.9.0-next.1541123853272.tgz","fileCount":57,"unpackedSize":652180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb268XCRA9TVsSAnZWagAAD2EQAIm5sIbjPrK5gb2cMlUG\n+QMIoEYzyULfO7sxWQH3DTWKAW81gVeeYUnDksRclRn0cHxtJPaXiybACiVu\nN0gZArNN4IFJzeaOK1GXQ5Y1itNJCeA6fd4lJiRGriGZReyM0h1IxF4MSCCY\nzzHu3yxR9ayluSDFPx4aCqlkRGUabBeW5IxdI5KZKQeFv+YQzWJlfVaKUmFD\nUu4zaMIlyeY7Ecix0+I056LpeeO7mOLR92HsavnBzUxxgAptGpQMONfZQxWI\nfhETlQ9dU9aR6VQ53UHBOOzDqqsoT+18enFMIOM4doYqTub4Xtt5pYfzmNWY\n3MZfoTfmZX4nkKRp6QnxFVvpPGILSLSNDKwmlgjI848P237PzvmUtAYQmpAs\n8SNbwKTHsvgwxbWyTWGgWpsv3QPiXNYtbWxh46xksr7Buw4V2k8CttrF+CCq\nb5l49W6eC5s1OyQ8xLvZn9ihirxMov743fTB1ni0OaldzElWptnw3O9NDP3n\nVYIS8g8Vf4cRX4SEobWZLAdIVxNwFPdu2IwJDlq1B/FyBaxyzzq7ZLwLVq0i\n89NvLYaLEMupiQ/sZTqc1CpJ1lqN70bkNEvp485dXF4h+AdUwqDIulNSEH+u\nTfHidUyGH0Ct/Jt8HKUXVhJ+l6lOev1T4h649BpcHsZI9XknVXwisalLBT1P\nN6cC\r\n=wU2g\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.9.0-next.1541123853272_1541123862956_0.6313364499093996"},"_hasShrinkwrap":false},"1.10.0":{"name":"puppeteer","version":"1.10.0","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"599821"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"e9d89a2e21b1698414fb2721eaad37b763362468","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-3i28X/ucX8t3eL4TZA60FLMOQNKqudFSOGDHr0cT7T4dE027CrcS885aAqjdxNybhMPliM5yImNsKJ6SQrPzhw==","shasum":"e3005f1251c2feae0e10c0f7a35afbcd56589ceb","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0.tgz","fileCount":57,"unpackedSize":652172,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb28BeCRA9TVsSAnZWagAAzNUQAJlQENMVBxN6gSxK+gI0\nhIPA66vQ6v5JIfau9i/BiVRcDC9shppZAZ4R1E0CdIid7BiCynSHnJGHmS5y\nv62BLV53cumj8eCjNAZJdkQscxxWm3iNQGTZhMXxJiKCTEz3boO2YROi8rg3\n/xZh7a19KRS8ppZsf+XnTRrGXdG1nc7jlSfF19dBvjaY0+P7Xuils6WcIJar\n6GnoBCBRGx8Vv+gmngLkfLUoZRx7OAT3HRbmVRuA4J5VKUuLEnj6sWUBhdiP\nESnF2nX8HmabXbsH13lFFqxUq4YH9p6lWE+eeGQgSQCavnKYv8RntyuvUN4Q\n9lz0WSFuFVIUN1Thq9WYDll0mCqLwDzrwTABTp49M4YXwf6arzRJYd4JUjA4\nc+4k/GKD5Je/ZUyL9gdF1PuOCE/Ent/Ofh83zSnRgmRw/bVuCecHjeXfnTM5\noDub5iWGXJKgv8/4oDC0Z+s4YkuB0dN6L+7GDIxFdNI5en4Q/ZnFsHR9ngNM\nWiwyka1FPcd1Fn6YmNTnsFvNXWtzwVhtJHjj/t2dCa1I+N+smT6ruvsAfd/h\nHW2abkstdzrsYzdoxKyY5jhF/Z56sumgc/lVu6gYsi9lXreOwy6CFXmlDAPv\n5p0QA1lRm7Lj/pgMr05rt1Aj+yljHEe7O02zxk3RWhSZVBYSYr+g0fSxBA2o\nvVfL\r\n=wMbr\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0_1541128285445_0.2035993914533749"},"_hasShrinkwrap":false},"1.10.0-next.1541128319410":{"name":"puppeteer","version":"1.10.0-next.1541128319410","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"599821"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"e9d89a2e21b1698414fb2721eaad37b763362468","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1541128319410","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-ngSRg/aXan1TSMSXtlPV8y8UjF3tYM9iiMxJQs4sAtnYJdjcB63KSeTlloADGF793cR+O3yrF5eg4gg07/G34Q==","shasum":"68a7b1da8d3fbd4d5bfc4b44ae47283379cc1113","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1541128319410.tgz","fileCount":57,"unpackedSize":652191,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb28CKCRA9TVsSAnZWagAALoUP/imyQ2Xf3qaagh6MqWU8\n1cyX+zhfAnnrGDMhg34giPtCaUACwD+r6LMKBGXXwUGStkaBJI3jCZRDwNAE\nMWlvnZNKxp8v1Z8vunKMmRh1ytlaN0zc+xyil84oNAe56dwcCX9nepatqMJ1\nz9MiJEeX9Pol+kKfYovFqgXlaFTZ73MuJHYvIsbpjKK8xrLsFhVy4ybUIP/g\n3QoZ9Nh0B2xo9ScKwHi0DNC1/bYHISRIi2Rmj1t4aQ+quokM+FIY0cDUSR8T\ngRi5OyrklVgQjLfuKHDd+j8pR3z4AaQuOoyPz7BO+t3OR+8zWph2LPiHohqk\nLWIlgis/zTA+nwcMUeECrbiupEBTv5l1wkOQTfF1ZAbVYl7hrcHC6p8JYa+W\nk1E0d6OzEEq22dGgeZg9Un15cFE6Cky1KUg0TSW950KgeQezEsGa+g7hQOkd\nJw2ZPfB9idrglrOm0+BeHht1b7z5wWec27FVEYjrElabtLbaOViuqPYjkLW5\n5jiUF2uYSrUoH5LJZLB8fdo+84k9kv9abiSRS26t59cR+hnTjiKx22pgbhE6\n9BJ+FcTIsPP5rBeLDo7Te9z63otZrauYGAbc+yVpMhzCpku9lePCMdTUKQAp\nJBy8ZXNKLC+45sMRsaEsoVjshVO3qBGJnBoHN0kSOAxfxW/hE/QegcWoV1PS\nXqPm\r\n=Pwml\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1541128319410_1541128329621_0.7654157781684747"},"_hasShrinkwrap":false},"1.10.0-next.1541182312825":{"name":"puppeteer","version":"1.10.0-next.1541182312825","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"599821"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"60a8d4115d5a75150c690027df4cb81c98561a3f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1541182312825","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-R0dx/dcRLPY6vzBBGAkngQgyZUCTgb8uamstdhxnau7CzT4zaqQBs2hkn339+UGOXztLQKttk7aZ3XrQLOzviA==","shasum":"96ce09879416a0fa1dd1ebbf47ea9fbb2718d57f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1541182312825.tgz","fileCount":57,"unpackedSize":652191,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb3JNzCRA9TVsSAnZWagAAY0kP/1qBGi7FZIv9Xb1hQrjM\nyx6fwXilDxdEMP8e8VceRFgdyd48dXnk8QP4ncnicUa7A/Uvmh9PaZbW4X55\nmifq2gz9wRm8+oPz+L2cE1nC16Pnmp+VrM8CIhtsSrWlNy/DPGMq07CUhftZ\nC2GYS4Gm0BNjIrbPyLYrtWx52+Ka9xvdcg+/ntj/3ZaFdC6IVl8vuQJ0Um0f\ndTMKytCXyYAN4ZAATRa23eoOZCeZBtKrMfQkD2NlbPVy6rtYHOsMtebtSF+q\nbclQPN+5LHAp/cGt0DIUcxgbBMZ5wquOqqU4USv63cNcMH9jyMYhORLwKATy\nTR5isnlKqPqkBO3jcHVImgZA9yxXkMy9fy5DpKQwwP3egf+45D7IIWvIWjrG\nzQdsZdOlV1en+pTNF9SrRELF9c4mYbZRefVCkxCibDBHSV2zi0vXFWDJC21X\ngmePAQvCLcNycJV9gVznpVB7ZCOVfvrUxI8s7wekyOi6FlRilC1+t5BCvU46\ndlqi7YBUVfrqhEY/Uwh7Zf7KLCQ7o/mqOzan29UF/K8SUuzcu/REuNNXqW/+\n5+Z6lVVFMZKgYmx2mcBh/deJ2+9hc/eH1LODyXMxevgREo9iCv0zTP5onpKD\nIm9Q039dhxNcWR1T76s9TbPPEbcXXdreduehbCe+JpRhVjpZ1neMQOZI1E/9\nFjCR\r\n=xp/L\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1541182312825_1541182322725_0.6218705842881189"},"_hasShrinkwrap":false},"1.10.0-next.1541190395602":{"name":"puppeteer","version":"1.10.0-next.1541190395602","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"599821"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"6b65407ab6ee634cede15727045c6395419d81fc","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1541190395602","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-lQ7lfxrvIWBcw2eET2kyFO9Fn97wJeg1X1m5EYtLUMq6GM4hSDzAZn1yGsLZBL29qtaoN+gz7OJInjhRJpmXrw==","shasum":"b76b9412aafaa1394fee73ac0e6c3caa46e624b3","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1541190395602.tgz","fileCount":57,"unpackedSize":652191,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb3LMGCRA9TVsSAnZWagAAHs0P/3A16wzVOJNapmVg00n0\nQpOZKSEX5FtNsLZ/5ZDnwhcS0cTeUKHOzO2RmzMhhH50Ee9qJQfTeMv81W0i\ndeyrJzGtEbdItpagViswOngmAPqoKQ4V3rOYF8rXBKP2aJcz2Vt6ktsovwvi\nbVqQ0ooCxah+d2avhVWflIqLzjt7Mw6UFbIimWQjmyVsXCUlaQbr2VXXoLWf\nG5QlkkwhWm/rTQirzUK3xkkw9/rAgUuutmKHeSedeiuNUSSBZf8EtUVRwgDj\nV9H+fsi7C2/V57Uf81JMj4wvL7tWpu+Gn7KfR/Mmki54Sn1rgULJZx7ASlSF\n+EMMCODkBFYpADYs/ajimw/8Cj+kIqlO38/7L/QWG1q0z9flMtYrTysTghLY\nQFPeX23BQMemv3nLeDi6I1/UadjQioXU2sqzRA4Co/Aitj/XfenIkN1e9+UV\ni9mJjokCvYPH66nlJ6tHGXpPijhZzrKOpXHS7Gr4Z7BLkojVeFNVPU8G3aLl\nLc8imORDks8Wcvl/MDYcWbhZQleIcVQqKMlvVwM4MFAS8mV8XjVjoQb6uhE1\nTmtawVQC/zHJpfj4M1kxZbgYvIroVz+Qn9oU8SGbHxsb5UbJ7MPe5mDIsgbT\njkmyfpT3YcS3RvOb90NiA9RoMaaLVcmGr17FscAPpi3VsGwhvE4h7TD/aFIt\ngn1S\r\n=8Otf\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1541190395602_1541190405761_0.39322429308688567"},"_hasShrinkwrap":false},"1.10.0-next.1541204340403":{"name":"puppeteer","version":"1.10.0-next.1541204340403","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"604907"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"52a103024b5372d5af24d5dbd7932e68a83589c4","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1541204340403","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-IDZeeSF7Xl9HIM7nmefUis2excbscjXx0118Dg7IWpUu/T1yKyz6gi0bN/p11nhN6QJh2m+gWI8wagXfu1+l8w==","shasum":"852598bf8996685e5896f01204ed8c8dd5e4e23f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1541204340403.tgz","fileCount":57,"unpackedSize":652191,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb3Ol/CRA9TVsSAnZWagAAa5cQAJWINNxsfMH92CzDHzCN\nfh0CxqD9poOzjmXhyCyvSijqWfwqV0WqOhpkuw0cDbJ3MvQ4vpqZFBVwhLnY\n9HF72VFLCB8jmG6GqcG91/SCPDTPATwMQPCcBXD6/VyM63fqF/PqFSg65Ztb\nxEy7m+m71ndUD0KROWPuqqPay1qStro8HMHtvZBXGyMsDvR2x42ZXsz9w7fs\n28Iy0rrpby5GzSS26TuR0GlxrdAtiwi15DkoepFyK6E3nItsdHK0HlMIKx98\nAd6O+4bOs60QhtyJFYLtbC4aTRgUfeUG7a1w6KpxBAy5BmNfaXt+fiXJrEV6\n3qVog83CZxwGkTuIoeOqXpnYF6LPR/UaxHL0EnXGoMOQkeow3eVhAk2NYz6A\n9f6I6MeU6HrHmA13mTSO2jwMyeUIwr5gEIqcXXZjwkzfobIgQr9hsiyXOGpr\nFvfqWd1qZnDweEO2PiZf0p3AMBVI2FaMlncGjt26V3ifTJ8S3GOcRERMoCxi\nvx26bgZNtnE2INcL86WpeGbiRxNCmSevL8+Fnqhgmnp2o7j9SUCZYMinxPhp\nWtecxOHe4gHodOlkcL94QFhliUoVNFXwg+xJDr+aZV5VaonZi9V1PO3qUOJG\nUncNWDVLk6QfPdjriZFwvtqYI1pusIMvr+rRnc8VOJzWc27HtSQuzlR3pa6V\nFEN6\r\n=lwBF\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1541204340403_1541204350338_0.40578355826548096"},"_hasShrinkwrap":false},"1.10.0-next.1541361083518":{"name":"puppeteer","version":"1.10.0-next.1541361083518","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"604907"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"b9f2104f439327d0b4bca6c572ecca046c0e4cce","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkcr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1541361083518","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-wuXul/0UtNNWi+MIFRZZAW5KvYfAQPtiVm8tlCbI6thjaGmI3lXBM0Bm3ORz1VnhR53HHOAdcKq4oArORmdrdA==","shasum":"d46bc8150032e8d56db2fc8bdc424f8724d868cd","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1541361083518.tgz","fileCount":57,"unpackedSize":652191,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb303FCRA9TVsSAnZWagAAgGcP/1EKQtZ0bY3W5F2Gn6mI\nZZCwkaNQp0Rj0PeCm5bri3duAfHgRO56p1oCJjokTmOSl5QdnP0Fa/0+/YSa\nTN7WgTmNkXZ5qud4YvkjEy6dud8NT+ocV2Ztmf1YfwLHbC+qXbQSWBilrAZu\n9zReEmf2S6Hn0Ze6vDuulbr/p43SyANiSyACWrOscB8QKNpC3zXzNX6rO3yw\nCaNQCGzm+WwQ/Q5aV9Gi8rx3RAteN+LOQBD2MtGBsZNZ1fXbRenwa7LwXuDS\nmklipoTiCh2n+bQ24k6HDdtfuxjtoUOyOwYUAMENkznmNa/vOP2Ors8AToRr\nNkgIzkE4USRRpAQcI1h4qi5+UjADGC4byAz9leYGJt9MZgPe74QRfOawP17H\nMSEezc1dqW6oHMpskgJDFPxX0bNhkzkUXRjRaUdiitdGJ3xm4tvnozsxoV1N\nt+0S3PV/Rwt0ujYmkxFTQ3Ot7sRuZ/8L3xwVcCQnONXubrva9p1vMux1meSQ\nXvs3clKv7ds8BLlh1MAsZNLgHpu7qfWZVBtBOhr4PCVoPXOB2CBzk3hwOVBm\nSGkMM/kij+1GqstyDzRHVZtEUWWrdkcp+a4EPrQTw4+mW98VhU16+XUOnD/M\nfBQGcSGYqy/hUaEa6vVKRZWfCFbs7XycVNs0iL/4sSNKyaEJh3OwW8KxfA5v\nsrdx\r\n=D2JZ\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1541361083518_1541361092859_0.624049991178286"},"_hasShrinkwrap":false},"1.10.0-next.1541659909504":{"name":"puppeteer","version":"1.10.0-next.1541659909504","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"604907"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"79ec7a3fe5630cb0ee186c8db6807bd0ff2e0f51","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1541659909504","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-9PUTio8MElRPzKbKCOOw9iElyI/sl6bk63pJ/wbMxBTwc0t08HGS11hikoveT3fWXLZUlPQbsa2HPFckqgI0Mg==","shasum":"4e44f14b22aa60412e025ed85fc9479d3985ee5c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1541659909504.tgz","fileCount":57,"unpackedSize":652667,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb490PCRA9TVsSAnZWagAAqSkP/RLHWDnJJFWqGHRiH5lQ\ngp5wl7KY7C9zG68H3MTcmLR7fJ+uRhJY3n+BfhlANGSisVUCJlZdD50nvSSf\nTNkgACVeMzMYzV0VLlv0wfOJ13+Z16LGoVbks4esQ7BVvD7dDYLfLfmkDoJv\nxOmVcSWuW2k7XW/sPiIYMZXZKDRiwRX9IGlapKs2Iu6NVwehvKq+zPYf0SAj\nfxWi7mXFZgppHM2RLWu0YZ7wB5YRFY8D8DKzf0x9YVt+UMPB6BNjwABcTRtq\n9mgCWWTq59kBW7GkNpdTL3m9nrKywyX4Uskr17dUOfcHm6M+qliKXMU+sGF8\nibkDbEX+vW5ftPq2Ifl5qaXAX2P/DtFdAJyOHh14CrIAR/nlt14GQcp9SXf2\n2YUG4za9FhTylrptVR83zyOnFUa89Obzxy8Qi3y6x3ejNS6EMuXUsw372QGM\noHZvOPdYBWBI1vbl4WNbCiuHX5D0HLeJDl9VbImxUKpju7MMI5iTZ4+BfmsI\n63JMN+j+2FV8vhybByWzk0940KU0kKttMVws4jA9yZv79Fbf/xv/kKFZ0MkC\nfiU9hbeI+2ey8rbqzV5uzphim/tWqb+tpSYaDK1U6EAyJRfUnwU8wnZbXrtV\nkfXO9bsk6cH+qG0NfOkxMdc1WDN+0VRFTzeScXSsU1U+aJ38CgiGollb7TdK\ncgnj\r\n=zCwD\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1541659909504_1541659919099_0.9620007816941292"},"_hasShrinkwrap":false},"1.10.0-next.1541731034635":{"name":"puppeteer","version":"1.10.0-next.1541731034635","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"604907"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"6693537f95ae6805da62a46530a704f88a442550","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1541731034635","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-ipYc1ESAt4Vlx9Xjkf2WkQU+FaX3roEjnAJ9hZbg07vZfT4bYpwyla7SQGsGRqVym11JCnOqz0hUaPRsUdu+Fw==","shasum":"d3e562aa2929a414f1f9308021b02dd91456945b","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1541731034635.tgz","fileCount":57,"unpackedSize":652667,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb5PLlCRA9TVsSAnZWagAAw1QP+gM9ZqAA2Q89iZvQxSXr\nOjtd6Dwcx6R9tF5KUOdV6vauAR8afNxZFpFEb49WkZ0JiqsktP9i9YT90tw2\nilje+y1eIuk/gFz79nhjtu2Hna8AseD0OhgdTvbMcZ+SUjlClBb8SQ0/wYjY\nSzQe1A1M1UyNACoS6saD00tvj+LbAr5jBXEGjHElCcdnSd8gX/Fhmm0CWFJq\nKjweNRVU9bOeicsWsra3pB0sN+zbK9Wz5oYgqlq5/hvBF2ZqLuHvWZ5yO6qA\nNz+vWPrQH28R6atzPyv7/OeGyulMwRWZU8hure3dwF1e7OfRzEF3k9iqzfII\nTlxRxeZWNBXXMnm91evZXDHikSD02Ho8Stl5IJZSVLYTktrUY+PSfYn40IV4\nEYLFtbsRRYSAgQcEqk0I6a8HCFFC33PBMeB+e8SZt72n3QORL3FBDFQuOamR\n29ew9wDHXCrI1bAnURiPBFzPyvcyrXyscTd/BWZ6DeHqN9MioCoQ5EAkI7i2\nWGTWTiYmSQh1Xc9V7LP/UyjpIQyrO3WviMPYUZzLnguXVz6XeyQCi2H+noF/\nlDfJm2dVHJ0DeHrYDIAH7cwgf1R9CkTBeYPARRAq+9Our80vow3jBJaAW6me\nfafRt1PHaG2N/L+vicGxRb2gESgzmx5lOkKXna3wddda7DMI0T+BVLlfP+Un\n2ZkU\r\n=XtTB\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1541731034635_1541731044309_0.14828075217335424"},"_hasShrinkwrap":false},"1.10.0-next.1541733757076":{"name":"puppeteer","version":"1.10.0-next.1541733757076","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"606647"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^3.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.0","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^5.1.1"},"devDependencies":{"@types/debug":"0.0.30","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^3.0.2","commonmark":"^0.27.0","cross-env":"^5.0.5","eslint":"^4.19.1","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.1"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"1d671c69a385e6b40090bee907ddb7b3268efe21","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1541733757076","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-zZm/8mv/SNNZ00CaqeWaNd6DNeXrIJkwqPiPP4fsrn89UxpfSuYEZt1IXKAnTFYXEoVR4qD98SvKwUYrq/1fmA==","shasum":"06f1c2356bf06be32357822a7e7e48bc86a1dcba","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1541733757076.tgz","fileCount":57,"unpackedSize":652667,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb5P2HCRA9TVsSAnZWagAA3Z0P/jLsYLKCXM2g25tqJjjp\nLRF29B5CODIIJTUKzXYoTh30a632untewWd2JNK9QtCGJGmv2X9Ugso9+0BK\nEq91HhtbM7jJVQXxaXvm8H3Ie+dMNQ80Qqz+oBA8MF+pVKRCP8MM/TiS4SSt\nj38ScQUXLNOAnzezkAaIKf0evEqhwJRFhEw39215wijfZgfD4xCNmNlEEGTt\nInRUMoXOkIFwvJJiOTVwciD8QgUGJjfZw8fVwCsooR+qfRpKSnt3uS6Y1+Kr\ni4qhc3MdXOuJNXhlZTrMYTa0IklEVtp56khVO8rNllLiKdym8Uloi6rXdBhT\n4yfcb8gB8/xap2olXayFEQ4mMjnmJE1megr4gn17EI1mugsIe+l7ylHdd6S8\n44hRLJHaqP1x4tc54pIQhtojJ+vfIA9Fm8GN5NIa5np4/1rcSofAVOSUuofG\nk7C7+dBWRE1TYBySXjtRqkNDTe9jz022f7k4hpKMLCxhCYFo2CK4aFY/Bn64\ntQRIj7UbOOqkdiabReWlR2303eWHtBmD9JPE69yNrQf/eC+KgTRowzZviNIG\npRmG00opvJOO9bbWDYq57Ypw4z9R4m3JIWTjGPWnKjlis3cpOdcrsHuhuHmy\npcaRSL4MMA0aUoK50XeUCNqm0wtRoGvuSo1hYSLZR5C3C88G57KOkSV3I3IO\nHCLE\r\n=e9kt\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1541733757076_1541733766603_0.18321759433624063"},"_hasShrinkwrap":false},"1.10.0-next.1541806535405":{"name":"puppeteer","version":"1.10.0-next.1541806535405","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"606647"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"d3f50ea425af38516f671a22e9d42363e7d681c5","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1541806535405","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-y3jKt2SbjPwvh/d3vjnDJH7P4Hi1pdhPKSHSr4pN1JLhufZhXk+nlO4vZ6ryK5yeuAYEEiCxH/TYPwU5KusBDA==","shasum":"fc2442d3819b5bbb36939f5c23fca0a92377c3c6","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1541806535405.tgz","fileCount":57,"unpackedSize":652666,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb5hnRCRA9TVsSAnZWagAAiX0P/i/aWhzCLSbvUKyxvev+\n0MTZ/1AU2mSlvHRBgeXzVQ3g4I0Q9kU+kKHL4lDUOMb3LOCYfDJKRlTF42VY\nwEAcdlcfk7ZEwTYn/OBRxh+rz6eDAyRGHzyLMVOw/YIClv1QI7Ktl6ZZjXyd\n8zfxqsK0VutkckRmcasiuOFbkr3+vMs9UEH4zNIxu7qtIuPhEy7YcanPMqq4\nnvx9RNT9v6cLeSY8aBveyxWPLsbKdbDtSmypDfNPgQ4+q7nKU4NLlL0Guc3F\nrxOWDqDoHoWTlNjbfGuN85QQ/QN264IEDS2wQEEAtWyPrn/Fdu6eXVOkI2h9\nafl04dFLirWgsuvJvqWd17xICFv8oNnNBtvce6Y2WqEm81HyyFnchCjrNTuY\ndbJUPT27qmuTHXZqcbIOdYBpEHO4+l9RMHpMsxumjIIIZgROdygPYy8QM7s+\nuV+3HerBTztYqt0+Q8oyzn19xYZk1R4YWKukbFZeD6XWXsk3UOl16o9lVs0r\nh9ce4sW1QpDCYbAJO+BqdgBot4Cw1ZF9kzyos1v7HHlcJriUgNirA6VCBLV9\n2i8ItTAODy/2nAFWzgd73BpLMVlWGbJkSHwrXKhiRPr5WImRM+n5XRiqR6QE\n4Mw1UckvUwuIer8KaBNxg3Z5BxksbTKoH4D9JF1T7FIZogGWc2S+E2OQpQqP\nGSQn\r\n=Lgw7\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1541806535405_1541806544884_0.5674142585094712"},"_hasShrinkwrap":false},"1.10.0-next.1541818067358":{"name":"puppeteer","version":"1.10.0-next.1541818067358","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"606647"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"27ea226bbcf5172e7e9b2c7e98ef629dca555ae0","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1541818067358","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-j4NAIXdYUV/lz8GABo/mDCkb9jgvhggi2xH5vjP9x4qKPVxwm2t+q/MGxhu0e00M2RPKgUVx/kX7IyTzmjEe7A==","shasum":"28974531211226b0f9644c57a794eca234ecb535","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1541818067358.tgz","fileCount":57,"unpackedSize":652666,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb5kbdCRA9TVsSAnZWagAA2sYP/R4A+3J5WFqhe6tDt6P3\n+WpnKWS7AxVtlR2SPguiZOCr58wQXSO1lxO1zwpiUTWrW/GIQMuc3K7wEPvP\n9XupfFdGFo/8ptdkySBjy/eMDn8jUbPVEjAhTJojJuOFs6N8HxM9AHjgdc8Y\nu/lhT7jULVMgPSMLjoTeTNavxoMcv7GnyYklm1F+p2kZ5Cg2w+2YOOBrD9Hv\nts185pa2s4bhZQgiR3LDyzjaWJnnoYyc+Gb54D6ixlFs13QLzY+9xtQqb2LC\nuXvxC7Kbb3rAPSvOjXz+o5JX7dRsURdedhQnjcG5Ng1cNVXkLtHBI91P0x+J\nMsbJwGYq2wSEYbkg4MW5+h3/tUBezxeo0LvHy7wdpyrIbvK1YeuIaqtktwL3\nCbnVhgTVo7uBf5YcZ2tdWC1K6Ih4ivGYBkN4mYEenGnt6gp9X20s753cyti4\nH1ZMHghqy6KsP2O3tPjNWviuzuLMrNf9857s9ruX9l1EEiG+Z13ACUJBXCTd\nOntnHLilBoInqIWDcjDkaOLH9ZlNRyuKnvTqP7tMyawx6D4Rh/xgyIssFfym\nZJ/Y+VbkWfexbkzOGuwnUkHyh4FsB4txPrSqGJJ1FKr1N3YWE7MEyqmh0/EN\nyK4EWUkXtXUrpdpBJluTT0gM0NLIrSu2uFlelcp5Jl38DKlZeDnwWIibZYoo\n9uzy\r\n=XBtJ\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1541818067358_1541818076980_0.552358609443212"},"_hasShrinkwrap":false},"1.10.0-next.1542056531325":{"name":"puppeteer","version":"1.10.0-next.1542056531325","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"606647"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"568734386df96403c827378d7afa5e8cbe521700","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542056531325","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-jzfYjptCOgv5vhhHSPoU46zE3Ly5gCSCUZdY8WFba6WD7YMWHylVRBUl9/C4ByHkLtxoY0UvqO5pyWn6/CmgvA==","shasum":"a2ead9c2ab0de2535507ed0f0300e6e099739abd","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542056531325.tgz","fileCount":57,"unpackedSize":658966,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb6epeCRA9TVsSAnZWagAAbBEP/0asQ7VpHs+k3OHkoXTY\nl5EVpHxMoHC5O3meVhV8+LcdjE74Ki9H0d3aIi0gQCCaXoSa9bU5UiR3iVYH\nDm1DygBS1IwbKRW0bUB+BpJFfKjDqbsTkBstebQFaTHoXLnVK87Jpl2QwscX\nRiRHtRqkpHUoWj7DLf+/lpCtT1skbdX2ESdcEg0eRAUbP9Vzsmh2FLqylgtE\n69mo5sRMNbalXM5H2d2PKKKsHbTLrHCXPxsqAWjdvOsNj4xFXxGzSA2OsGqQ\nxEBHm4x6S130QgcDa62s77COvQFZiim2/x8bSBVIMFSOwjD2Kr2oUXhlbPQh\nRrfqP3FGvPZRnQBzkqCMUlT055US8e8m68hXkzASwIPd3BZTb4cZ4ISl6lPy\nn08mp/u6DiJm0ac48mix9lnoxfeDByopfXMhwmvrwz9/My/UgXb0sCWFAHRm\nju3HGpPAc+70SV4GbxIRgyLcOlVWPNf3QdenTgQGyO4W9uSwj+fKmb/Ut/2h\noEV3Cq9+QFa5fW8QAZNvL/Hs2wDsQSA5ruqGbkI1DG0UwHmJ4q9pr8dZciko\nQ4wBA3AzU2SDVjK9v2hAypeY0Hl1bvBdFLFjJMEo7K30Z/vb/lJFIALSGM3w\nO2SXmeDpXEp/9X3ErVsMpGubfze6z9PkW3wvwxyaIDSR+dc8EV8vPvdB3sig\nTnTK\r\n=SNdU\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542056531325_1542056541332_0.6195295093281923"},"_hasShrinkwrap":false},"1.10.0-next.1542062579254":{"name":"puppeteer","version":"1.10.0-next.1542062579254","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"606647"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"10a4c8c123adc1362d33db31701e6a46ac63c6b9","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542062579254","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-8pBHz+KonF80BiRnqoxy1vCR5EfJr/tU6zlsxvF0lot7qfSKoFJPViZwfE6YGfen82vWze1trosmmmoltXNjYA==","shasum":"4200917dd82cd9db55999f1d1b7c6063f1e9607c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542062579254.tgz","fileCount":57,"unpackedSize":658966,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb6gH+CRA9TVsSAnZWagAAMIgQAJsukDG+o/ITZmqtVtlO\nRcI99KbU6s85PnsLWX4+GMG2VHSC/x9xM+iEiniF6KcvYya2LjCfRzsMDsr/\nAX/CwO9CliH2qBOCBYPlOOEtgN+RyDC1qWXCkWMw7jofXZsphX8pDsuIY9J3\nsuWdJjItn0cCSzgPgCGNOXXASxApkNeqR8gW9cNi5dAgHNnEw5lpWGv2Uu54\n45ZvCaKNm56zMzi10nOcviIbLNYl07nDVgyuPJca2hWlO5oIXjPPnbzm5J2Z\nDZaeRi4HERn06lHR1n1yiInixwjKUQJH1GQ7zJyAhBmLRoL7y2YTHbKfW6JB\nhtlrD2hSrO02d60dYfk38xU9OAb3rnqfw1HpHbO0/ZDrzMSUYkIgfSIIYdS1\nH2Q49hFPah0QSFCjVov5qyvpe0yIuCHzqWowvhZrRemBLanH6ejssXMSQSr4\nzQ/FN3IgC1G0OxrT3balccX9Z5pgXzdXrssv4ecMvY7PW2GaAl6gV2OueFPw\nUzwbXtwBaJD/8OwIgV2phiomXoMLgYgTkZmo90uGhQxsW1G33fNSaJf4XCwz\n8PLOhe/xMxzYmfrA7b/Pt3wZek2n2QNNmQFvYzONBVUHKbLXpPziEcgwWc4F\nuauqD8akbOYQeLrn5KAFrXO2XxPMA5RPNWQV8PENDLgqTIGVjdAsiV1cD+4K\n+fMi\r\n=Mo7i\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542062579254_1542062588682_0.6264362540180235"},"_hasShrinkwrap":false},"1.10.0-next.1542094148959":{"name":"puppeteer","version":"1.10.0-next.1542094148959","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"606647"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"eb7bd9d7d3a7800e9ed3d77a19aaf4336587026c","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542094148959","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-a/qO9r44I/qPLh7NVkZlqPU/GOrL85psJwK9/wwDJov0PEIgo8awhYVYJSG4Y2Ms/H2HwG8bAH7MX/NrVuxKtw==","shasum":"1ec333de444dce97472ef432f7cebd4aebffdfdc","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542094148959.tgz","fileCount":57,"unpackedSize":658966,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb6n1PCRA9TVsSAnZWagAAxIsP/3c4Kb3Z7DtSsPnx9n2T\nDLhNjlx3f9/hOiO486EkO9Ct/F4WQuLHhwMorPKkNqUpuMuspZKloqXg5yXU\ndjZ4pd5qnBi6OTw4YotoMYrxh/weplbVTrYUZ0vRKrXtlzzGSEpFPGX90K4J\nEICDxY9ru204MCLvCfgcywQonjjVynzPpeHzZ4fvyRaks5rbV54DDn1PG8vh\nrmqih9jy2iP0P23XNXX74Xbb7YrZk0gd2fBr+M7JFUEARRk6R/ekhQb5RAJk\nHz3cTaspbvv1Shx27SaBzvLeVmzDldS+xZaCUG6B1vbcJT13NILY3G+rELZJ\n7SBoS8SkW/T6FeoyyZwJYNsNfY7wh1OQ0ikfr5I2dSQwTuk6W5A1ii9ZNMH4\n8YwmFrNsDfhYmhKBWOF80Jn6EHrw7GNfhuwoQqeF2ONkWSeFixUjbBHODoVc\nXQI68gSGOgoTddTims8sN2FF+YqiGR0IG9Yjk1qQDN8bG6c21QncxLAWa8ta\nIfmFG4xbY0twbbU0aolWXjaEhiPPn1Tjc8N8o9AUdKUgubuicjJv6/j3gsli\nmsGvjgx9HR5dhLPM/8McAtPs78qI7VFB3iheDHYd1wPcGgT9BS30yRx9f5eR\nm3MCRzxoQIneOZrR2U5ps6S3AHIJ412I0AhYrw6htXQRNZ+lx6FX/scX27k1\nOj7h\r\n=RIYC\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542094148959_1542094158738_0.6717936985092456"},"_hasShrinkwrap":false},"1.10.0-next.1542152043928":{"name":"puppeteer","version":"1.10.0-next.1542152043928","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"606647"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"766a9516b026b2a79d7f0b2a37af77063f78fddb","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542152043928","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-wgq4uNqYe7jXPER02o49vaEILlys6/W0yFZjldBL4RtvyY1ixPDhwL17CllOwuWSOcytqMuL/rKt325XiH1EpA==","shasum":"a388537c7ad7d413fb0859be8682ea86a2156d53","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542152043928.tgz","fileCount":57,"unpackedSize":658966,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb6192CRA9TVsSAnZWagAA/LIP/2Gc8FOvOtE8pxzIkCav\nyA0MW/IADjn9hMvD/6KUlzBtmkDteDKH/kE5KfOoqr+puNnFFZHUqQZvkBQC\ntsndbOGxXLjwHem6tGhiqC7VlY4clx61C7pjLgfkLtMkT1XjkLE1eSsrT7m6\nm8uzrlJjs2tTQYwc1YN5KcaACGVVIAq0at5x/u8BswjfQdtmPETr3cxZPYaD\nhmfRx4K5ZxnmxW1CKbOCYLdzuFPsxuLsDEDqkruCvV77CDkyv6ldrJxGmUWs\nDA/zqv1GSLmGSgQjlviVLkW9mIyApm0+6MNFzrs5RTyjPVJJzQHCDklH8ak4\nQO5/i6fFOMNJHLmagBxXmGWgZobBuh1Z56i/Dh+d7YAjdO8QL/1208+LjgXC\n24Wk91xY2sg9NC90rRmmMmUqQnpU4xMVFhzzFmsfhr2f5AJZde1x8AEbCGz5\nKWGUKOEd4+WP+5lx8j6fAFAW5WTDouHVFN7kUtRbXgwNTIxXsrLGkrsuAvfd\nDzfCPzhaa2Gz1krYBqEXgJy+ABTWlm+4DhZG3IpR+uW9R2Nmt5uX+tOG0JJS\nKMCSBrB9gDX9HszbmFTt7+jSnRZ0Bkk2fNIiq5om17pNk0/VxVpZTiUXAgJL\neVNqU8ZmHCwYPZnZaIm3oIG5hgPiIZN3D9NJxhbFT61M22UjGwkloTjKWYxi\nkdF7\r\n=rmN0\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542152043928_1542152053584_0.37756987464314595"},"_hasShrinkwrap":false},"1.10.0-next.1542224682151":{"name":"puppeteer","version":"1.10.0-next.1542224682151","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"606647"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"c185eeef6119141ebc07f07d46ae0dcb16a555f3","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542224682151","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-CyeWLAdlmLZXakmFPtsbDUmHUs+p2h0c5pnPkpoWmLybWGn0vHh2ffCYC2NndHT02gV9RQN7+XZ3KAf3mr6u8A==","shasum":"6ed7c10500a7b342da5c98b185e0c9cd7d4b3705","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542224682151.tgz","fileCount":57,"unpackedSize":659353,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb7Hs0CRA9TVsSAnZWagAAZU0P/iTiFtwUse0ocPK6D9pG\nYLh4FTyAE0Wr4bJBjCM1qWE6QKHuVK6wILEQkfyTMGb6QNu4bcqpz6b4quBc\n5qfiUi7vKXJUDOWufC2kgQCvLGRug4rGvracwSKx7ni6KpQmdulzw6wlA2Y8\nIDYldRxlxeRfXSh0ZWU+p+NNNgZpK2oMs7/oD1KMwmGnZjwe7sRqHjd+neZ+\nELvF+enEvUaihnDAl6nTg03FI9Dlr86RoevK/3zWkUsFRxf+EyYbGamxOPNm\n4rurymu3muGEqF931RO7OTkuUrqZ1OzkDrfgigj+L8/ErlK9PLuGeNoSj0+s\nOGbsjcPqB+pOYcuirJ4aZzPB81DOnxSD+FO7XMHeRL0l4NRU1qIJhijE5Qyl\nuV48eqv/mjGh1qmRHYd4WA71ME24/coShfe/1w/AXh5i69mjxV50jhlAEPHb\nQgngm6tGkqXrF0+nmD9xkAt5U1Qz2KkbmUKHFdHPFyFPg96ipwJ59TQtncda\nDb4ec219V2nd3VahYjZ3+6QfOG/CJBNxqs18okY9pKsSubZ3N+LwnewUhRf5\nstum0ZiwtbJpw5DkDW9z6wRzkZ/CDGJD3AbExe4Sx8+kNAOnBqjYnJnzTyOw\n9IATGLvCFKlDxHN5azAS6IMsADFoJ2k9VKIBF1C5jibYzBr72NTzMJu4YfG/\n3GPA\r\n=6WEG\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542224682151_1542224691440_0.03362627304021992"},"_hasShrinkwrap":false},"1.10.0-next.1542322461212":{"name":"puppeteer","version":"1.10.0-next.1542322461212","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"606647"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"95a19c74bcf5be308d596bd4ca32f4b9d46a6bf4","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542322461212","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-RLKfgciF4oRy+/2H+b9eqSn90UaZYB84qtnzP2oIKhGR+cacrsUQEzsuiNDoUz6FH+Wcyyq4VmCeYWtwkXbn8Q==","shasum":"5dcfd0b37a30b7eb5037c76270f741a86ba95b0b","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542322461212.tgz","fileCount":57,"unpackedSize":661411,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb7fkoCRA9TVsSAnZWagAAdjIQAIALkRCjGR9fzm3kYCqo\nWUv3TXn4xmVmvO3hGge04ihhdYpv0r32+zhCRoJfcKRemgXZUB5nEEaWfAyq\nYTyAbIojNI8UmsxCpr1xCiQH1n//M+faGw5NFVupxyKVrvzNBBRIXLmQsG+G\nxfgqHo9kA+pSlu9UEPhlVfsxzRIw9uraMeAwpP8iW2v+iH8iyTpQYPj4awUt\n56BZYxpa3NPxzYSl0enxpswaQDViw//q+qXRBwntgA0bVq5WifRDjaN+Fk9/\nkFiGxe56rf4HYEXKDDzQnB9LxRV+VmZNCb/qkcnju0kEn8Q6bNUp9LBe+Cod\nr5JcNe3a9aVqx0R+A/lnxTIhZtsNYD1gxlEPJV+ZWHSD2Lh6Q9u//4I5n0DD\nl8zZhaz56BM8lcpH2+Vnd2dsinsF9oYMfM6Mcy2Wz8WBtT24gHPqeFGzSZal\n/g9NqEpyI0lLvYlqhuFlb313CvreO7ngK4Y1GKoFna8K70WbGQv074LI/vsU\nJmVBj1Be7KuQceiw6id24RLCDCb3hK/Y4Olmie3vvgKM25gV5stukQgRMWt7\nyCkXwinpyUIxkZS3+zjESF1578q9QbewKk/uI6DPXJBXqzElJhMZYY3Gg7Km\ng3EjT2Tkb/KPb4rqppTeHNcYDM5vYPxO9dsZbWu69JRABxid17kgZKgX/aQW\n58OJ\r\n=9bnC\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542322461212_1542322471539_0.5771463981534615"},"_hasShrinkwrap":false},"1.10.0-next.1542322813531":{"name":"puppeteer","version":"1.10.0-next.1542322813531","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"606647"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"03d87462606e585318e33cc135fd9bea5e116446","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542322813531","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-XJZF7eEiTLeiKUoHN73aE+RkNXZZvVC9jznSvcMSUZl3trEJk92lXSVbAUS/uzStvtQS45NcWZ5NxdB7lMNr6A==","shasum":"efd2d3adb8242065d431bf2163e95a1094ee9a1a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542322813531.tgz","fileCount":57,"unpackedSize":661411,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb7fqICRA9TVsSAnZWagAAdoIP/0Wz/MKbX8eSW+f3a7X2\nVEurp38spN1qwqfinNXjMSqbF6QxMN3Mi4RydYvtMyx9coJopMjMglX+GFX8\nmp0mZJU0sJ0uYfdDgxd/04KvmgkHANWhXosvRWjK5kZPlaS1Nhy6KbNlwi3W\ndydgQtw5JlHY1JRtc3i/CX2xMbEQ41Y67lnoUTfEjX9cKt6hRgcN+WV86uvJ\nXOy2Vpj+YEp/12lGv4YGKP/Fzrtai2qKqKYRhe6XuNeVExRlVEJ/IjyghBJ8\np3KvRE/CBK6WWjFTJVMlzRkOI9xRnj2PgkvtwjrJnKo32BqDBgC+wWE3Ct3o\n0WEv6t1ZeBEXGIK87EryybNYwGklBstWJRqzIaiveMnYOpZYIlNIWgTJl7oU\ngbKPYERqvbXrWthyE9s2LysYk6KAgpcoa7tC4F3pIZRyATHTjvnXMvEMvayG\nwdQqLSemGSkBHXYO82STR309skCSkE/mP4sF5GnIPAbLhvf95mOqj4utmwJo\nzmqrzHmrfzM5t3CKSTKpTBAzT6wTJtxvb3ZlOOqbvDXdjxphqwcUYlHzC2BW\nfk2giYCHEMQXYBURdJaing5UET0nMenJ95SZG0w9VTvC36Zmx+C+voz7HtrN\np8asicVWbGQpEfRSbdnNf5AEu3aJpslpGbzaYy3vjLoKo3pkP9DoyGgGiU+1\nrfqc\r\n=xcJB\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542322813531_1542322823303_0.5865980036864131"},"_hasShrinkwrap":false},"1.10.0-next.1542389962978":{"name":"puppeteer","version":"1.10.0-next.1542389962978","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"608752"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"d9d9996f9cbb2b8a188d54e0a3b1b47e19831f27","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542389962978","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-MK12zrdC44pRoBwJ055KgU6QMqUzv4xkSch3YLYCxtQMWBFfoeQ+3lN4LzS3VESPA6wZTMs1GJRN2ZDZ5RlOfg==","shasum":"c2b3181b47062edffae6e05c4ddea4499c055160","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542389962978.tgz","fileCount":57,"unpackedSize":661411,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb7wDVCRA9TVsSAnZWagAA2AsQAIQ7KnMeKMUkFsBBA+/7\nTWkUVaRZnvDLtz6hAp7pdOAJkIS29RvnqUq/+OQSxxEwWjvqKY3b1bFuHzpQ\nSdZkoRG2Ftw9h1xJ46GqoOcqM9e//O+1CTA9XCrgMINHfkv4YzLVZ4tsyImm\n3/NUTRHz7SKAYCZzrQZ88wK+WFMe5VpYp+rEPNwm87jO6ycZDBVVsOTmmtpp\nkghR0FMgavJPiVRgVD6e2Mvi8cBBT5F1TqcKjVa8olvx+fX4d5UrIwNJPd0l\nPYlSqB+5ITZopR1yGys7wML4yhbuvs0hv1jN0WZB7MVwMlPwe3EGsK4xk9Uf\nLJ49cXArLm9DB8lvARLoB4vxD3m0JxBvOQcOCydE7GL81LVFNAMiVNVTMNqP\nVxJ44WBEz0si8soTDp1ZtLaB7TaH+2d2MeWp+cfAin5lzObVZilzLf3HGMWN\niC6cLrF2aN1Y1ALaMqdM7/KMTsHX8gK4K8xXtJYBSiqEV/9OPb8ak9hC8AlW\nYLqAhfT3VZrv7NVE9WxYyJW8k0SUasm2bmeczdLwXgOWX5P3Li3sce5LjLUA\nSelSJgOb2lvjw1Y5pM5Ot/Aya6MYpnZnCh+uIgXdJUgbdCyEVdaluDQX7MMU\nQxJjPOUZDooQL0RvneF0j3QQzCLY52aYjNGU1D09O3yJIpDd12KsIviZ/v7P\nduDb\r\n=9ZRj\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542389962978_1542389973057_0.38793674716170146"},"_hasShrinkwrap":false},"1.10.0-next.1542660024620":{"name":"puppeteer","version":"1.10.0-next.1542660024620","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"608752"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"86e09593bfc262a77798cbf9ab28754d242ba5ed","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542660024620","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-HC4Dz1hg/cbQXdFwxVxs2souN2QDYts0hUtgiXe8BL0J6aOx1fhCf8FXHpVsvymfjVniu7Fc+f1Uv5qjaOUQlA==","shasum":"e468946739e77b59d8f1131c933ec1291bf403ac","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542660024620.tgz","fileCount":57,"unpackedSize":661411,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb8x/DCRA9TVsSAnZWagAAUUEP+gJb/pZ4S4btA9RH3OPK\nPN6DQPPn9pu48xkMFyB2Snj47/bJ+PDiDRZZp3jqWkuFIglJMRvfb2JhnfT7\nKD6RUahpORRBClS0nbhUXiWzGQyparluFT/4dQG44MQpnxgnGoVj2JDJGWO7\no93tqe/g72qWVnbfEl9Q/mLtqVYT6rGSEUUNdilMOQgSmyu8jJUkyp5YM/Mu\n3zNoDhGEXIeZilu11LyiQpu59zetM2oQmen4zbPpzX8sBX6/6FIJ9k7bVjdV\nHgi4XrXn0qVbpuVHwnwr41newGBrVwET9qwc45LDGDS/hyMY6dsq/LlQ4RPL\ni1m0DwjdSvaNxXlukBCFUpczNGMjHbOPeCRMiByhhE+M+5QSamBXMQYg1nhh\nbtIrQ6D+6dhlMeN9JiPzA5T47Y3Nsf5cSZFLlMUsrKlG6qXZb1mRIXDlmaMu\nNZpLnWr1n35fq1A8ODjwatcCvw9vDdfdqA3S6QZOEWyB4syeLD5jpguJzCd0\nrD7E62HiIjxb5C//ZZyuEYHspFyKSydD1i4p4u6pY0L3xnXFnPbKenY4iOcI\nOnTnOLnTL4QYYrnV7+8kBW3ZmAP2yxdo9d4RTCjVyI6IM8p3Fr5oB1vzF3y4\nCZcVeGHq0p/n+ZyncnQKaPfgnsh4G8bl6db1XbC/fjXQYW/OCp2yXlJzoqTl\nhjxK\r\n=RDt1\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542660024620_1542660034502_0.6499742984212853"},"_hasShrinkwrap":false},"1.10.0-next.1542752643857":{"name":"puppeteer","version":"1.10.0-next.1542752643857","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"608752"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"e2e43bc23d2a81eb9c9214fb64f5fff3b95e6590","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542752643857","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-JKYPEQ06P4XpPQWGJcuINt6ccjLk7A/1n3xtbhE8xSPUN4wguyoSBjKQ8I37a2onVt0q8nJSWNqUG+TlFjAGXw==","shasum":"da6b1f75e67686a2b4cb90519dd5983b0b5527b7","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542752643857.tgz","fileCount":57,"unpackedSize":661627,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb9ImOCRA9TVsSAnZWagAAG7MP/0s4WU6iWN1ke+E2juss\nLodd7Tn7daHKSDZqmn/3qLGtRtE8vOxOPH1OGBuWiEVP2mX1hAYF3rtliveX\nqh5yPyPdrbjQjO/hO7IVnzEcNWfi0KLpXDzXpDLHRVG0ZRJtgoaajCW6BOva\nUvKPm9trQCMLUibxcCRVtm5FeGNAI+GsLAzdBK5/1fX5D83z0NjF5Xv1uxS5\nnFgcJdgYxs+nWlfg+nBconYiqIPYRj06atsV2gou/fJZ60wsxldeUS9TSCeL\n1nO3cDsnO4FOuv+fUcOmM5OVaXgUhiXf0FhUq6JzdmgOeYsVjvtfEyFwpohi\nZ8E7dn3rA04oxBo98DAE0cVurxM/YHsWzmX4n1OjFfXp7gb9pQfH6BNKLr0x\nRVLrjC+I/TRzweuRmymf0ixkKuMymL2VB3V4ZnmD0W/j4qIFizxS1wNCmym8\n2QCxwFb7Ug8VaEEimQgqL+Tym1xHKsRWdcLsJ4nQy/Xc+K6SIUBlEWlWepH6\na08n35l8k/O5fpRDCHIob5SWGImLy/w1c7JstUqBJQxx+JNc6SiJ0VSFFxnl\nqFh8+2TdgdAAnCW6bTX2T6drLXR8MrEbpKTt0ACm7Jd1UIUXejJImE1Gb50B\nKw9s8p/N3bNZQ13NoKG8qf8GGxDvv6lmFT/Thh/a37iqEL5TQjokw3F0RGew\nznB+\r\n=ppRA\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542752643857_1542752654028_0.3920274956728824"},"_hasShrinkwrap":false},"1.10.0-next.1542756975192":{"name":"puppeteer","version":"1.10.0-next.1542756975192","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"608752"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"927d0f443b832609c91ecd7bdbf1945a5d219c60","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542756975192","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-000clVMwV6TDCFV1jvfM/aUMA3aRfAjFL3gAg8ZxvmauC2yDVn1WDBnNN3Eurw5D6Tl7Z8DBM9Jf4fRk/ncBvg==","shasum":"48a829f9125e5a6ad1ba76c6e437fcdbb4026252","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542756975192.tgz","fileCount":57,"unpackedSize":663323,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb9Jp5CRA9TVsSAnZWagAADsIQAIdbOKyvXIPQEy4DQKGr\npgSzyFbbFRhSSklQ08UDFLsZsgWoYL0WQvDbCbCvTXrd7Dow4wC1esjOgP9E\nEYNVyvhP3qHGpA9p10EfnuZeb9oqdMCEs3sWBE3E2i0yIhmlB9Ra8t3u5Vwc\nBJ0dIFIcATWg/+sJeOeMoeDEhXz6YmK4vQviDunLUmnePXTgS4NbuXSorVO6\nzjxqEDdI3w0Dhi04IvkHnqavsCkoQ2Xo+oCyaLLNqGAUumMThp5t1cj7fU9O\n9mX3wpeCaDFkR86K1Cnprc+3SjmulvLeXMND622tKPIJoisElg2Z+Utnc19c\nKYI/X/14mldI6m3HfFC2KMvYknmHnVqqDQa95MHujWt5ld2xYjlUGX1QlXu1\nuTDwRpJL/urXsGy5rPtpoBJQbMXF1cT/ePghcNcp0uWL3456WZu3GMHAcd1v\n4XU0tgO3HOadViUHmBJkXlWLapdpUntHnaIFeq1MnxK9HgHS8AupZS0hoV64\nxfboCOSTYJAIBMPQxe58bbCzDhuN9FoKJAjzUATg8fT1u3yFR5s/dYjIoaLm\nQgSoG4tm3lf+52Djkjj4hNTneXIrVTHq9UMMSc9/9Dn5OsKyI8wwYrPSwO9x\nlauYZvpIZ+aGbE2hHyhLuD5QO2WTziKUDsSC9sCYMPytrIy5Cd8DWIdPbY/n\n9rVv\r\n=kCND\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542756975192_1542756985215_0.7963240049492264"},"_hasShrinkwrap":false},"1.10.0-next.1542758792020":{"name":"puppeteer","version":"1.10.0-next.1542758792020","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"608752"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"a04100c235f8b8b50454690b93836315dc955b4d","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542758792020","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-TUi8fbS9aoKZgF+nqLVcTZRylnhwB4CCUVVSs4AfBMx/83s1y84rUnVyJ0keLDrIWmBJKBHTNs1FbhIrIeTtuw==","shasum":"e68faee1665be7293b19149d29398f4514c6ee60","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542758792020.tgz","fileCount":57,"unpackedSize":663323,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb9KGSCRA9TVsSAnZWagAAHcgP/iuoT9M3CqaxvR6rR9YS\niV0hf/3AUBSluminem6SjdeKapp+AXekL8aaZq+vS1CtCeBzDkaAyU7KiCiS\n0Hfkw3ISm0b4gLffQhNQN1MX1l0v35hBUhJ2jkI7fXiL9XTdMzMONwKcz7c6\n+cruIvgXkqLjRYebqJyisF8XOIdc5Jfl+Ebp2DHd1e/tvi98eYx/us1Z3ksd\ntkD2NWtyJO/p185omjiiIqGGzcdFPyeQLCPSENsQzDkkSzoH/Gyk8VUf2g3h\nm0DW8SI9IE2gbR1oFEgGwgWeejBlXm44O2+yH4sJXRd1j4znlSfBzvvIvzKe\nuqb2rpGT437q4fOKFrqoEKuqg49aWu7SlFAG+kMNEkczEigd6U+2FtQ+OaSy\nAIRiDKZ68JuJWSA6VeZnhqQcPrI3fUHkd1D11XIwaEX4kB3m2BP7baz52uXz\nXEe7ji0ZmcFxkeN6PbXGu9FYv5cxJOIcRAoUOJX5w0nh8PoTZceuxIu0ZpiE\nMAgXrUuID7E3hQMivWAEtti5TGpf0ecXcNs1MmFxDaYVYL1OlAFfWj+5kj9v\ndtqMGmGb29ylKhS16CUMtdLeU0XaPzTa3dyh02+LfT91woVq5rcCc4BdlO2A\n2Ik5ebQZW6MLMduIaWS084ErBTVuU2W6vo1QtkB8JqMjNG8IEXUOlgQAPh+f\ndNId\r\n=wcCU\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542758792020_1542758802224_0.5049489937288425"},"_hasShrinkwrap":false},"1.10.0-next.1542767763738":{"name":"puppeteer","version":"1.10.0-next.1542767763738","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"608752"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"aa9fb82f147de37c68581b4c427f0a5b36dd009f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542767763738","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-oMmIC4gCDiUd3GQlqZbFWCODekBHVZ6r0ihRlw5kNT0ez0V2Ohv07A/PazZmgXv4sKIcr4/fdFXia5jKCAPsBQ==","shasum":"54572c0b2540051b623b16036a218d95f92e047d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542767763738.tgz","fileCount":57,"unpackedSize":663323,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb9MSdCRA9TVsSAnZWagAARiEP/2mO2RoC1Z1/VZDbzZG8\n+XGD2dpayZxsTbaJrAOcmUc0v49RuQNa/IZt889r8VUvqO8iWFiSMz6OYVGF\n6fE9pvg6FPJezIiIE4iTU4zHyQk0RW856j/+fH0gfGygve1TPdx+fR8klcjG\ndmbedSol6DQuI5ZEL2QUTi67jl0/aQgx8kNTDZvoPv/XHqWyFrLnI52KSJP2\n1NXbCIC4nkWbWz/gHt3xiWpvYVA0t6h2DEzt6+/3g6ecipRt/RcBbhT+LOGf\neZ800yvRpmUFIm9/rAlv10mY8Itvn6W3GcWWN7dx0sXAVh5kieSOXWiWkgrA\nYlxu2OgB5VvzQGrlCPW2OSzQdO/D4Z/9R0+BRrQtqVTTPv2gg+3Qwsce1cIP\n3+CucDk/Q6IIn/7/TM3cZv0FVGUxA74FeCnBH0H+wasuhoTGlgvsW71Av6K8\noGDVbqC7kJm7WGZYaEdvlOKe9vKhpzFQEIFYQChM7tZ86q8zErQI8l0MKos3\n4QjhatrWQZg1BCCq3keGGAIxbNYbsmVFwxFoLpwv8FG8yoOe2GpZ8cJ22A+Y\nhIXrKvvVUZo9VO4ehuQwg5oiDTnCnYISSO+p75H9NuJL9WRqAk6B9pHSpJH2\nQRqtN+yLePKgOH+y/yGQiuhfEEQCiEFdAD8mAVWT4OhfzBpoZN8ORGVmUuPY\nmXpB\r\n=B2as\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542767763738_1542767773239_0.29810051973215357"},"_hasShrinkwrap":false},"1.10.0-next.1542768537315":{"name":"puppeteer","version":"1.10.0-next.1542768537315","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"608752"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"e5830d1199fa5acf87c1b3b439133943008308bf","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542768537315","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-vwhWarI+zUKcv7uk9RvIjEz6QnSRVkG8jEA2HufOivJjUJfZp2dLC0YDUWoNj6lQXtxEoz3EIObnof8yixcDHA==","shasum":"8501b779de3210fc32b771ef03fad507e791b3ed","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542768537315.tgz","fileCount":57,"unpackedSize":663323,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb9MekCRA9TVsSAnZWagAA1q8P/RCrL0s4i/4hFiG4h08J\nys1RIoswCk9MHqe4wCjLgrcbDj7bw9IrN8MX1tzJqOMjSzcQaOaZvP3Sl7Pl\ndDr1Q+5l1mkrLv/b4kfa0KaLvZd2s3K6y4W+II/lKCFDxse46k7y55Wi5gJw\nXhj5ywLshRFKahvP/mBJL/otDSkS9PhpZ+o5pXyRwy9GXe7UjjlIGwxaaGPc\nKpeQXgYRMgzWWBv9PpaUa6GVg5fnwPJ/O5tvHQH/8beU7qiLfRtLgXJ5/uxx\nxJWOFVl8b8Kwh7/fcCXpT8/TAzJkR7X56Qb6L2GrGgnWAdaB3mwv/kp7DD2D\nl/Xt+fh17H2xme/Bjayl+RWNCl05S64Sh5znmk9NsOvshccR1Y74WxPzZ5Ew\n3hyBLNvwuVZ2iBtQzSAffRF+ze5eyEF5D5VAwxQ9Vx6PLHjn4gg7Z1BIhMmg\nAwu2/DX81ajYgCT9sD9TDrigPT39K5eTD/qnnRn30D4ZmvQhGdtvYWrNTpoB\nwUiSAAxPF55RhNLOJAVOhtMGdfJ0q6v8dGKdZu7IFD9z3+pxusc3nT/pCf6i\nWyZt+1F+Hlx4PSzIht/U99yO1D+z6vEbHpMHCVJTMmxly0BaLMdwrB1EKdMl\nIX/32vojso7xLNGEEBDKLOLdGreL1Qdug8EkXXmD2N8gCJRY7Fb3sspXCe01\npZzd\r\n=r2f7\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542768537315_1542768547324_0.09057867640439188"},"_hasShrinkwrap":false},"1.10.0-next.1542770480356":{"name":"puppeteer","version":"1.10.0-next.1542770480356","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"608752"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"a181bdde319d90dbeae94c10cedaed36fb6245ee","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542770480356","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-gM4aAXTLNNzyOK/T05/UhQh+uM27B8d9p2RrGmnMPkaMO9UvrKK3+2MisbQzVIJZlHk4whntJbAdzgBawBWTQg==","shasum":"49efca20549ad6440052ef8f6a9b16d4f30d40db","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542770480356.tgz","fileCount":57,"unpackedSize":663323,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb9M86CRA9TVsSAnZWagAAcOkP/icq5UFexNAasU9DPfi7\nHirKIlcpAqgLLkNYW8OMQrT//J3AHnHKI1jloBzObyKlyYAwip2cSMXX4lk3\n1QI4EkNKHdE36S3qZUU9dGs6ELsxAOmu3AlLqe5+MHx+ZXN/KyrGFYw3uzO3\nkHkleLNP7J5A7J/NGFyzFxxq0SPJe0cy6Jdpr+HWkZzrz/1AwwDFRlJtBQpM\nbdt2Pi9pItRL62u22qpY9Tjx6Rv5eZzcM54gTOKKNW/xxJCQGJSO1/DhnDjj\nn67VAGgfF9whI4LTC4luwKn8LsAdiGzN0HGufu33ZQvM1knicZ1RxvuBKd20\n3QpaMi/h8xFfp1qTE3tph9YHuwfwqj+fNpxW1jsUjZ8WDb6+Ru6PAI2G5qp/\nYMN+xIXLKSRK5PKWrzw4HmAUGbjEEZwBqKEFU8SJ2TaKpU7fURGmd8qyhnmF\nPLM+GYmZkfdAGmtJ4rEqZT4iddKsCowntL7UsMvf8tExU1bWbFOAjHz7KJjb\nTu68P70JmbacgRgB8zEdOiJ8znw3P4HRSr3BZ0VZc9i6+Mt18TS/NHKZOA7E\nZkql72xMiqr4OG0HwXwmjpC0Pnd6hvLo76SpWZmuf8W8cauEnnd/cWNEtAJh\nTzc1tUbnvILuFsL+RqsC4ncupfeudLMF1K+92pOWeeJYNUbtZ1EGyR1VwjOL\nNMRF\r\n=4d1z\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542770480356_1542770489992_0.10902655956699148"},"_hasShrinkwrap":false},"1.10.0-next.1542771500097":{"name":"puppeteer","version":"1.10.0-next.1542771500097","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"608752"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"25f4f26851d14c96afc3a13efe11c26b6d822370","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542771500097","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-wy5lRFTudB+but/1nmMJrXwyW/r/I4sU+RMxWRAHqXwYpWp+nubLL/7HMavL7fFHxkVgtIh0AHsUonvFpsw/oQ==","shasum":"89606e5d98a891f6a6c27a824c26de984bf1dcfc","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542771500097.tgz","fileCount":57,"unpackedSize":663323,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb9NM2CRA9TVsSAnZWagAAxZgP/i+MKYIkTNuTKlCkKL5S\nSjSIzumjdYBuGkMSl5qSzafInVTqTC+sRcn9eEhUpfSB1m7YrIWZU4aszOxC\nQE74ERXmBrEeuatF3FLaFELo3j/UAW9t03T8WgtKJ57+ceFP+zvLZ0lxtvGE\nsrDrchDY3vHNsuaTb5E4SDAkXNi5n57XGOfQBUoiB1SuHnBsSGYLYT+hj5Mb\n1lm+SBKta0tKx7oWzzdeEmfn4G+Xjy5zrG+apfzT2OL2w3WYnj4U7XCiKCYv\nboD5RjFkXhJszixZndmYdgkVh2/jCHSQormVdev1aped71PtLj1hGQ/1CJfM\n00c4nquuirkCPD6FVqV4MQVSwkZL8n3w2fH2PC12YIePdy8uKAE1ezeTriro\nG8ygZ1AqfBTw/5GAo1HaX/GXGBQdepkYVWjvycskDia+sJEaksms/WhK1TG6\n/7/lIvuzJOJ54LflFovnLoerzr9v4vlM9qX9bQcsPQ+JeLqXLhqKlcwVeOXE\ncV9MTaZn4QynMwLPPWwwI/Cl3deZkJ9e34WSt3S33omv/HvLa/wmrdN7yfJp\nm7F+24ZLdnHFOGGs7efFi1lBwemKNfC6JLnkwkaKdllb8KoyaBOUFesjZnQD\nq3qDHpIhri2GkSmlr2wUkbtaVNNfLuYTT36Yd4IqlntRNvhaSddnjWVmNfDc\noOWl\r\n=8Zw4\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542771500097_1542771509706_0.350925230850164"},"_hasShrinkwrap":false},"1.10.0-next.1542771982956":{"name":"puppeteer","version":"1.10.0-next.1542771982956","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"608752"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"e83918987a343fe200a4813a1317482be5ab814e","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542771982956","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-7FTlKRY/K+AgITQonYpWxJrB3NVxi7ntnv0oGpOkDAeHHZyy/yqpWHIuZVymTzTqw9wfw79ez7S/V1DCNQQo7A==","shasum":"49cf4648ce4d4713af54fedf73016e8b533a1976","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542771982956.tgz","fileCount":57,"unpackedSize":663323,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb9NUZCRA9TVsSAnZWagAA9hQP/0CezfH0rcF/WXJwcots\nZPZf+0yY3iHX6Rmifcdth/6p1rmVi8OkmbkVh3o6Pta7yWToVQ1SaBi78opi\nImZE/SJ1jPs244hiOk8JxLfHLtImuihBT8PwcYf+ZjSyfI6iwxYuOfiqY7Io\nS6Vv2eRQ0UA3br8SkTn/OdvKSusVB8PXQuUVaMH6M9TMu8GfSykz88zGRsN2\nlyGGODG+bprrGWJWof6Of+finbr+SGITAveCM6s60xeobqFN3HlrjkNmHaDi\nXvLF2Y/mVkUsg/a3CGG1cOInS8k2zBu0QUSz1acbu0BlPxqtU0g3OgzJc+Cp\n/Pbb9ZH6YAJ7sSKMWhQ4zuH75aOuUhz5mSIyAlVYy+y9CzFXqU6c8QJemQJy\nPGrZcWyUqo3tgKRK3SHwz+m187ZXxtpifQRN4zwwiLSd73RGrmLtYT/qfQ/V\nhjfpbDXbww4Vk158maBwn12A53845JOAgAXpRGk2pImf9aCP1JzbmSdOwB/J\nL2dwgICbXxwgl32DG615v+/S5EbTwO0fQBtgJg0NyOV6yD7bljKmv5zBTxGz\nikN/HinflJe2hpWF5SNce6cq+PvPrbORhIaOiNmTTi7EJs6r3KZzSEZqw6T+\nP/f+6+KBmN3xvxh67WKD37C68i8PNEgMpmU2p4rak//rlKAoxrdco9lh/p3W\nHrF+\r\n=8Iqs\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542771982956_1542771992706_0.680897744166125"},"_hasShrinkwrap":false},"1.10.0-next.1542773003048":{"name":"puppeteer","version":"1.10.0-next.1542773003048","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"608752"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"d61916b53e5b5f491b14288ea00f23ee7e31f473","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542773003048","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-+3dkI6Sn21WZMfMFqMkoosutj7N5+RaBi4VjvKECkIGGR1HvSl+79wTKRGGCpj3/PUYwfRg9sqHie9acA7Izuw==","shasum":"0342f509dce6b5fed863c312ecc5429cbfa27e87","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542773003048.tgz","fileCount":57,"unpackedSize":663323,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb9NkVCRA9TVsSAnZWagAAY5wP+wafAYEzXurr3FeJ90k/\nVOHTyJqeP33Ek905q4WDWRvGWgnavV7Y63auDoFdgZU6VTffuObYvbONtR9i\nn5eJwLZdBOkaJDBdr9QEhKItbQSeDWIcsuQws/XQ0OxCvNaqLkUQzYjSr1wp\n2j2tZ7dyE7q2zQ3/iKZ/HPNp5fH2FmRN25wGbYkduMAkJYw1i2rBsxRuTh9i\njNNTvE03uk2bWLSlVpF4Yv9+9r4WBOe8TN91LwZ7PEP0hzak6RB5/9aC6Ga3\nbOh93KlK/e+EVtwlQrTTVm/gJIDllpjjXViypZDwb1vZAxKTfi6E1bfeUavY\nxsMclRAHAqNkCoA9yw+KOP1Yxj7rbcKkpGhx6mu3cODbYgmkIPiMzKGOlrHh\npY/7hPPkMz13HcLea9qco7npK1NQw25NTrrtUEoWK3YIY82hXHfEHbNMId2L\nPvBC0Qv/POEf98Wim3MfxoEMr3v3y7SzSx/ZKNxdSNKdUqc9rZdbdpN0tPUz\n8QkItl64fd6LAdIaiMVuJZVlNea/Qv79trkLXCh/AkdXWDYkRszitIxYPnFP\nI/kO7W3K4O708BrUVntQX24ilAM3Q+XLrfKeZKiFfE7cAPpWrGKvwz6bLRRk\n6FtEOxU6tTi7wxugscnEROR6Gsglnpr9Q/wOQuBlvyxTDrImnL+SckwxgdIf\nwpPC\r\n=/ap9\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542773003048_1542773013268_0.7207312905467662"},"_hasShrinkwrap":false},"1.10.0-next.1542773565980":{"name":"puppeteer","version":"1.10.0-next.1542773565980","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"608752"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"309cbe625f5acee697123e422239358eff7c2e36","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542773565980","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-0DhXHUCPqZk8EYto8gyi/dKY2wsYB2aLROQac3lgnFtpNExfnqka5PHAXiCSeRvnrQVNwxaWB+8iynoz8pg2sQ==","shasum":"b9a8391b789627c47e217f54172640705a4a1164","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542773565980.tgz","fileCount":57,"unpackedSize":663323,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb9NtICRA9TVsSAnZWagAACT8P/iDXJVQ7vYQzjvy0d2B0\nkCUWHv39pRZfamll/mwxVF6MaMTfbip/d2VsLj/n+HI/a72AtyQ4fiwYq3BZ\n+0faI/Vo9LNQ7+62V+hA3s/UkSbxMMkwSIehZC1Xq3eQhCkC/ODhZCyQ6crT\nwsFyIyBtFsQJ+JXk5JVXoTnVn3ypZOQpcyxx3e+GT+TaLPggpzZUrWT+24Vy\nOZE6U8mt6wH71ofxF9NiIzMdjaLCukcde4oTBvWCFzf9zBTO+KvmiFoe27wl\nqXmQ7RlDjYsYtv9QT4J0ENPNesIlBZI0okICz3Xtnf+MEYCXH5BR60T5PTh6\n1Bzo4K3AuROalsHN691QDN6bOjWJXZ0gyLgJfkCaNNBE88IXv4ZG2/74l4fk\n9u3yvHMovyNHj0zhMpmS+7peyX42WCHlIApkiAGF3JC9VvuRLQVnouQ5jbDB\nhSyF+3kazhts1nyAY4JJ65VjQEQoWSCFKc4lLRVwjKSfcFduWQ13sIhzbVRY\n3Kw1TuAU8HCQI/EISXR0I+Tc2f213/aKwQX66m/LUWAsGkdN/MCkl9XimOoR\nVr1Ce6kRw9Mngyf4dLuMQUBVdpHj5nDd/SUvls+5bzQMn3+p6+r4OElUmgyg\n/0iSoqFnCEBHWvvRVv31wq2zxFb6Uo2vzhXYBs//yT1Qs87h7qoyJXhaXnnI\niv+0\r\n=oFuI\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542773565980_1542773576148_0.7185299481023439"},"_hasShrinkwrap":false},"1.10.0-next.1542779777413":{"name":"puppeteer","version":"1.10.0-next.1542779777413","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"609904"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"^3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"fb5b0800ec0da190de2b7f36d37f646d6d64f4d0","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.10.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.10.0-next.1542779777413","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-uly5XHe2FSGO3mdLZ0dWNf3A1oxZSHQsaLRt4neJ0rXrJYy0ftukb4u2UgxuDFzbmg1Td/ezg9dqQfLkuo+TCA==","shasum":"57e253cc58f979948e717cc580af03facb6f688f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.10.0-next.1542779777413.tgz","fileCount":57,"unpackedSize":663323,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb9POMCRA9TVsSAnZWagAA7wsP/2Fy/SCm92YOn09RTFJw\nKtPWTyq0gTPVS97IYW6Zb/whXIKWywgmsE6WKCMK81Neznf4oDkItAAYSTNc\nd2WbATIXVyhck85poakTQ/t2FDlpUA/J87SOavA4XI5dalabobM7aVNU6rOK\nEqtPcI0YnQ45e4Yp0VnVYtFHpKn7tkQD74ZtyyTJW0eiVib8tZpi8A186aEM\nfUw6KydLsQ1eZlUSizNKgGkrpetjgPa2JXOVTDH37fS+TwDFj6wEhqDkH4hl\n85XaoBwSp49CqsQ0p8r8Rtv+zwdsu9jQcvDZRj+gnCmXZORBCrcnGQULlNYd\nZR6iSIgOJ8TLGSWGS3y9JET+ToXgTjAWOfhkbr+nvSFPREk8yeNaSswLeT4t\nvfilgWVLkC0J/4/D1A3uMnnjUhlgt/0lhm8LssL5DL58gzGoE+vK4WqyzsVh\nSZ/Yb6SxolcHbRd5I9DtFkxq11gz8DvDGtglG+8aOy76ZP8iRqmYIOL2vwAu\nKptiM0QvEmL4DX44wldY3KIqOhS3vBk4fAMqBPl336FhzTdU7dte3wGnqNYb\nZxJbXSO7IdTkgCnxiQyczbjIzsOucCmrrcM/jIhKBbsLZQJ650nx8C8tiDIV\n6pC5METj7kxAaKkywzUtUOUXLThVwDDOEOp+9k9mv3Yj2B3d5YdZY9yiE73v\n7Ax8\r\n=2FB7\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.10.0-next.1542779777413_1542779787780_0.2149992020557836"},"_hasShrinkwrap":false},"1.11.0":{"name":"puppeteer","version":"1.11.0","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"609904"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"00b15994a410ed2d77d22159287355e85df70580","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-iG4iMOHixc2EpzqRV+pv7o3GgmU2dNYEMkvKwSaQO/vMZURakwSOn/EYJ6OIRFYOque1qorzIBvrytPIQB3YzQ==","shasum":"63cdbe12b07275cd6e0b94bce41f3fcb20305770","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0.tgz","fileCount":57,"unpackedSize":663303,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcANVeCRA9TVsSAnZWagAADZAP/R6dx/6T3bpUhj6CUhXU\n7bi1pmTfcDOXjz03OEOPqMiot4Vkc/T6pNVjZaXDrLqOxYh3IyWN4K+xcdPr\nf78ReFRgoRGtiNIrQ5R8J+sJ09Vp99XOb+bp2Ib8RKXDU+cSvJz5PZoBavax\n5LNdZIkarCHPWXbZfTjUIoueH8O79uB1rsP6KpT9/5v/sStYvZ6X9ZxEcDr7\nEW6/5Bw7ktyleBzV2eFgnGAK/HK5lAfgHrKk+GvMquQOzBjfm0Yv3XGCnbaY\ncUvqu8jopdfCyv1mdr9/h4tYJqrsxfTZs6XfpjWCcMpKwTT7HIDtT1kJLndv\nYLOm/dd7XOHRuyxCqXtq3QRcICAQJSPV2lG5GJSiT6g8bzIt47q5BV+1IXzE\ntqIYzbmlm4d+XKxYAoSWzl9tg+TFySYkA0vLICuiAKcfdY1gzzS0OKrsFeea\ni53RwODSz5Hpw4+o9jguCRjOw7ppv7eUohlQaBobbJYJ+Mks/PAFTFiaEJVx\nMnJamY1lI31kNXHrDqPo87X38gTiteNWxsJoROiwtPdyggP45L9cl1sK4fhj\ncNFWhjLLy9s7kG5TzEXt+PkMXzzAtNri9App8ZKG3O6bgRC0ZRVjNvxOK+mD\nXAmEJdIevqdSvcei4PN9lurgQY4PWs8aw/+oCY3N3bPEL4oJUIZdFo6Vuoi1\nUFuT\r\n=+hym\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0_1543558493640_0.9654367467889984"},"_hasShrinkwrap":false},"1.11.0-next.1543560147647":{"name":"puppeteer","version":"1.11.0-next.1543560147647","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"609904"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"45c4477e9fc80a159d8cbfe13cbe1aa5544a53c1","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1543560147647","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-mBA7C9bjq8RnIVMljRdsdXy97c8HENVoV2B+YZNkM54DL/xjF+8Yu0OuLxQGKkDRjRhwk50y1JNwr3yjWy3aJA==","shasum":"fef33e38d90147f9cb97efef5eaa2bbc33603e4f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1543560147647.tgz","fileCount":57,"unpackedSize":663322,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcANveCRA9TVsSAnZWagAA8gsP/jpVfPzH5GYX8R+XCH9l\nuNUdHgtdf/SJOOSdiJZ5WuW+Kpb98KsggVUNKyY7/NtZU2oqLoJQe3nvHbgj\nHpN3SWWpySPYsKm0+pmBCHapt60hVvfJIGx/SBjQhKyyQ0IlLLFLwYGI+9SF\nU7rj1SLQCSnRimoiFsdDKaOvc9EsMRswMjHGUdVR1/bg92qVJpXWu7Ng0IEx\nnnovGyIgMud/XiVnym/50aOrv9xqcJby+iqSzR0cnRSetEFDOwIHYarxyFqj\n9o80cG4Ogzb2jqWLKS39P3B6s0AJh33dIXQGyqY8x8hh+//CGnhyCn8SBs4X\nx4fViNaCw+QAvWPoBb45DvR0NmVfpLUf1a0ovdJBBU0GBvcxUkF6VlGlNNkN\nlZ/d1+6HbNOAL71amMSmTObRRpuakIiLdUdxxxkX1NHSruWh41+pZTp0L/Rr\nlky4rRSTSASg3U7YxG2IHcMgQCLSZB9gSycmd9Zo9KYAi1JWhSbAxjF2xuB4\nrKL7YTXin349eniJ+PfKBcXdOaZRU+b6LXDKWs22d9e/ojesCPdUz/PiklY4\nok7PhVyw/aXyGE8juwh0ftvfDjGoY6ISMoM82iJWxSJdvluk12CnecZdbD4x\nxB0rK0nV5weBkGl/qmXQC4hALrb6jh/WBuU3NRLly31zpHvUiRdYCbVONM7Z\nG9k5\r\n=/IUu\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1543560147647_1543560157325_0.9749295614275153"},"_hasShrinkwrap":false},"1.11.0-next.1544046420498":{"name":"puppeteer","version":"1.11.0-next.1544046420498","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"609904"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"8613e871fc68a1c0992cef6b3fddeec25e58d9d7","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1544046420498","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-KqAe8vCZ6CmAwJntevlxOIiPuxAgWbpwoMDMx4fBdFDTTVjawxnwoJIxPcOrBXL3K3qB6yC8Oo0R/BVtjAflpA==","shasum":"f07d2729c6511d6739ad39ecd5cb3aa78cf345b7","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1544046420498.tgz","fileCount":57,"unpackedSize":663322,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcCEdeCRA9TVsSAnZWagAAIaoQAJZxcCOgExq6uVA/Z0a1\n++RykicQYLbEq874SfH5TJ4EmaokJ25rq3lW/IBhROPNtEhcxTiIhlmWeKfF\njRLt1HIa7NR70Dn4IMuAt+QyEwPD33lRbtA0ZG3tbxEoUnI9GLo2Mv9dYVs9\nV7AA48GGvQZn846dcUXr1iqCyPA8Z0nOHZwtELUPe+aliEaTLGl3BoJ7lywK\nykY72Zboom8fLs5+V1mibqRmjOKg7eFCJZfjPPVbyKqG9Uy6nJZ7hbGdZa1Y\nJszzsJ3g44Ti62e5+19HHK5K1WDJml6aS/qkX1jeNFsgo5EmiRWB2ePEWwF6\nUqptuwl8/LhJtwsUBdX4MCS59XeQWAuQc/1O2iGYtndfwC6mmxK5MWZIrxZI\nTwWiRM0GadOeaVXut5O+e26r/MKxds208P2GHtdneYY0vrgSykho4v9YjwcB\nbsOg8H7Bp+s4ZWxAYFEFGCL9tlw+HicSfF8AYzIsMZwiXr+fb+dW/Rve3m6M\nF1cQsG1rtVynIMkrAKKvvi8XPz6vM/zyvWx/AUBsYYPz1s4o4HdMlGavQhQc\nmQ6gnGeA5RWfgqGu44EboYw7Y1jpYGz7zs/vfSGpUJ+3Dt9+6oyF/QmStD4y\n9URW3w3j0F3TssbeDTzl5XLBYDCR9/kpXZH2bwPZg8nQmZLzCmFIs3Mgb8ll\nd8Lh\r\n=TKgt\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1544046420498_1544046430082_0.9775685584674474"},"_hasShrinkwrap":false},"1.11.0-next.1544128541083":{"name":"puppeteer","version":"1.11.0-next.1544128541083","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"609904"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"be836bef638a9c761d145f95d45cc56bc5448825","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1544128541083","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-kM+NnKxG0pZsqhJ9lEdYqd4d4rzP694wqjdgpQVx9e1yM+J2x0bwsK0/1PF3bden954MmIaHZc1M4Nblg8+cJw==","shasum":"14209ebb02ec498b6f1e79502333ea3bb597942b","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1544128541083.tgz","fileCount":113,"unpackedSize":937870,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcCYgoCRA9TVsSAnZWagAA+w4P/3242DILooy0Jw0X0yOu\npXihCN2yCwpRbBp6+kDNarDufV97CKjNj9c9igIInO+G/7axM4Z9iYd+N30/\nLQ43OAInMGY9Eia4eIsfIUkvxe3jEq9GfHhIAd9MxpJJoHlQ4gTQLd80gB87\nN0pzHXzToqhUOjVsPzPDs3/wDjE5tZjY6TKpP+tRxmKvqGDh0qPqjwVHElY+\n9hqKU27GsQldijQjddvkyF+k1xPTNXzVPVTM69ubgmeZNBXT38kzyVcc8/O4\nSG9ZYJByYiyMS+gglA4weDeGd8uW8DvKdnWuuH/NfZ48crcIGdav8mwTy9SW\nl03HRALBSilbnsCNae5+8aXPu9RAV9eckZ4qeMOvHKmSzEyWT+RPLVHWRPXR\npchy37NtXG1rbFImsAI8MoaMtPeiE+gHZu/JCdpBAkzBPErent9KStrtKbnW\nmbvDJ73Z+aZ1mFKyHsih8vfBvm000IcW7xz9OHdCb7iREOHmmmHqr3QjJ/Y+\nABKUBZp/w896n64JVNn8oU498GJUq0aEaTYkCig2PDuA2P+99E6tiX/KktMg\nqN/xZ9x4PWU3R7NXZ10UquyizkYOs+geTyAYVTnRZ0w95QrLQvptX/Tu1AxJ\nyAu1NGCXUoxSpqLybkOhii6/x9/Q/nN+bF3VGc64VH7nv0+r04cYkRItCh+d\nG/Zy\r\n=DafV\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1544128541083_1544128551357_0.8900141961914512"},"_hasShrinkwrap":false},"1.11.0-next.1544128971170":{"name":"puppeteer","version":"1.11.0-next.1544128971170","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"609904"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"c81f03c2504806374234c95972f769e49d00e4db","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1544128971170","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-ofi9trdmZMwVFO4WC2JMtjex07jWLDFeY08FXQpNI+AOFj9JdKJhwbkRQpXvgRY5ToA6zDzLdkk5GQq7THy6BQ==","shasum":"665e6c37b703bbcc712e4fa212825905c90182e4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1544128971170.tgz","fileCount":113,"unpackedSize":937886,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcCYnVCRA9TVsSAnZWagAAth8P/2vRL24LqlOVuptCJXQ3\n9p8RgSGivH27M/FXpIjD5V6MBmTfvItThXcSDeVVuyjx323+tu4o8tAUc8ZH\nh2uyWz7C3x/SSHpVwes6oA+T3WG0paTjL0dKKU0xt6yYxu8WfRONimXTi79O\n7sK2wDBYHz0x7ZDMDO3a4dixbFUqS+CcNmuCkh2y8IALzs34fF2qipUgNzj+\nuffXy0pnkN+mGtZKAcdWDOu0kWAAr/3OiT5hnfVgFlUeNvRJQLwoF/SllcAH\nuKxioJ8Cmp4EN2B0d1YoR4PahBGS+YlersePa68yjnUZ7bKB4m6BybZitVhF\nzC4taDHREgLdaky98RU3KQ/JMH94WnjTG40Zvujf5cV/OOEEIzYWqajMtvS1\nBscgwUIb3Y4FF/OztPhE7MVABPMNvFVdrFXn19pKecE1Xdlvc+yM81DQOko3\nD2ABidGNZC/MmywyxoSaNOzwvUWqBDAmg/xgx/s/P1Hkx7s9/DzFM2W61TCH\nlXC/xkjf2Q01PigU4n6dbmrUeUyANay7I/FfbsuyZl6yl+mcSaMuLMEy+mal\ndrlc8wJNrRl6bJli6GEvmm3PsR0pJajppDaTcADd9VopbUsKYUhQiIle5m79\nDOEUjgEZKgKa8tf6tN+Ps/fthA4GouAUkf21K//H51p2JDFlZiZ6OEqY4l1i\nyGBE\r\n=15a/\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1544128971170_1544128980980_0.1000890106450334"},"_hasShrinkwrap":false},"1.11.0-next.1544134189192":{"name":"puppeteer","version":"1.11.0-next.1544134189192","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"609904"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"2c4198fbbe822bdd7c8ef4b713c9fffb918bf98f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1544134189192","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-WVVTG7jcfe22733YrngwfwLmVCurUWRYt97qZq9dn+rOwNO2PDMRFqQaWbz9TTU7pKxbf7LfCHJ7WvSjKz6rsA==","shasum":"e2529f5e3939a15f0e898d6e428fe2fa015b43f8","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1544134189192.tgz","fileCount":113,"unpackedSize":937890,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcCZ44CRA9TVsSAnZWagAAIAQP/jXkyu/ZplLt4vnO//V3\nMRn8WrM6luCFSt2as3F6FPWzHPYhcvR7HAzRW2ZtWz0YPUSMSqiaDuv1xl0x\n6Hf61ZKoERjQXr0C+SZSbmqaN9RGQs+g7wKsPE/YGPFuePQGPbJoHELjLh3/\n1IVUnmbJjD0KoTKY9N0BbXbfpdS9gk7dVDF8Qf0nTV0MJdU8MpyaUzS59k/T\nw6CZYNUF4tfFkgUAscPxiluYgdN6qbfAujR3rixF+nwcu5ewc4ZvIjowM4Af\ny/0lNi4bnxPGQNyJ+rIijUKCz24Jg6vzFNnvBr1s1bzUbvBFA0+nRU78N5J8\nqpQZsr0TorOlJhrMof6zTvdQZ+B2KlUkurAos/eonjvQE72c4dWVsfVdvoch\nVpO++B6QsV0kx7UkU5WAR6bmNWL8JiziF8+eiTmkcWN7qOM/awXtRJmlwW01\nMiuMjfRJjdIUqmYbAyRPO7pOJXXz5b1MHZ1ZCqOeZYBzCSe3yXCokAGFrbhE\nBDrRG2vK3QkSRvOs7J7VHEwx1jXqTbI3edvuYNV33bshUwoeGuOcBmNebqSG\n9sJ5IGkN0UPTdXuSdgFl+5tG+uBdfnUC//wg2l5T4ZEc6gfPmLyqv0Vac9PC\n05Nbv4RLL50H0RdHK6a90hzWLbLi0U16dF/1GrYxbrptrWoaHlbaUMp5pO4G\nOj37\r\n=r2ON\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1544134189192_1544134199541_0.3394801559134233"},"_hasShrinkwrap":false},"1.11.0-next.1544168352298":{"name":"puppeteer","version":"1.11.0-next.1544168352298","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"609904"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"0cccc586cc3e7140fb9c51d859943cfb39d83b02","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1544168352298","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-EIEQxoLfL18s1GpIeGp0PqNyLEp/c0alxvLOT30O6jvc59j/Tb/BGhlt2/QcLQOq7As2OdcUoOGAZzX7WSpKNQ==","shasum":"3c6e5266538f09a32c11a011fab13cec0ab878ad","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1544168352298.tgz","fileCount":57,"unpackedSize":663322,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcCiOqCRA9TVsSAnZWagAAVnsP/jR1Pe4eIoJf5LZrUNym\nFePcrAIZpIoPzDiSAATquuSQNxvBZV/LxEJl4b8dsAA/ApJJDNTDsl2t783h\nOh8xAfi2iU3FWObGTthZt4DhWesqEiUFsqWM3RrbLDyKUP8JUnVxT9wgUFuc\n7XFazth+xVqEJ2//TpQn4GuvM/S9X5EEWLOsdPtwk1e29v5JlE6HJI0QOHY9\nXDtFW83OSZrfVqYedqflIcrxw8MFDTQb1KZuMZDezKIPtrU0EzP4jBJf//1W\nCfdpWtX/MYScYPLEGKFm46mWDSsvA8ox69BA/vNIPm4LpAjFcpfnD5W9KB74\nL/jR1FeTnvhC2rNFXAX9uXtACwkvh+aQEqRaXpjXsaAQzHud2T2vtnrcEUby\n2TeUwzkDR00+A5C614YycweUT3ukhVgXT6hxsIX8E/jX1Odu7T2soAmgTi0G\nWf/HpskQ31rBnSNwwYMfz3CG7hjEH58zBB3DZKOjareZ1c23EAaXQb3M3hHV\nb9htdXv1YwXfxKh/WihdZpXiG/3KNgyM7VkNsfrOS7wAajQBH8CuZxpT2XeE\nQ3i41LEy37Z+yRiMMKjEDqf/tK3gXkwQ0Q365SSVSdd/eMLXX9efYShi4lwT\nNrcQRqXuS5m2moq3ZwoJJrSXFauwtNK2m+l2CGY9ubz5/Dtl4mp1xEdQTYeB\nQc0c\r\n=Py2o\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1544168352298_1544168361990_0.7356754011360367"},"_hasShrinkwrap":false},"1.11.0-next.1544560245556":{"name":"puppeteer","version":"1.11.0-next.1544560245556","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"615489"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"4346fa1978970c10cd7bc2ef64a765a49d261e7a","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1544560245556","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-zRpZfcMUDieglj0I9Bwl+23E+F5RLh5aFZ9FCWaASqcqBVAtvrQHO6/aOjVJHruNRg/HeEDhh7W23I3IFmat4w==","shasum":"090ea02c2f9775f9b8db7419c59adef1a0df310a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1544560245556.tgz","fileCount":57,"unpackedSize":663322,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcEB5/CRA9TVsSAnZWagAA9DsP/1aEaW73dtfaGFeatXLX\n5z1CaVB9grBryqvJhiZE2DsXOZ3TE0yGMCQ5coRbO+ih9qRsvbGoY++ridbh\nUg3kH90Ox5rOg1t9Y4WZSXoY1DlvqYKopqOP5ThSUZywF1nNvE4OHaxgEVKy\n4pTuwKJDtlde/pa0/ylk+JCeIve0/ba5Kl49+iDSHDeXZ/FDrHMBIGjYEEu1\n8noBNOmOpdjzDUUExgXm+BSMzEAQ9EulxUF7XGicsi2Sj6OV7uYhvzVIFdFI\nACNtSYuSV3JplAQ1XNPFHWn/rAkwdo8OELqPGeyKVwCeQdOACZ4sc7+MdC4R\nnlviah3k8WNY2BcaRoEFv0cRV+/9p8qm+MoT2bLbN/k8jQvznf511aSilycO\nWC/6PcZUzuItAHbH9m/CDPWIb65yai/uuZU7hP8UVjW345vY0CyUY9NPlPJi\n4Q2IEwM210O/ujddDzCW1rcW6JzUczd/DHsKdT57c2fJkaIB30NKpJtt+9Mw\nIY3ujFVV47bg/xy7up+VYsHnTdGH0ry+7Zbcn+Hy7WMqpdDk+8tIoaUfwjgZ\nLtP/g2+fu6Wc1JuUPhxoMyBlMgTv0ngrKbh8TY6X65kA1uzRPYJaXafswwwq\nOHSAR2l/Dyvdfm8kIXE8wrD4OQY/zPEuQ/1iJhMlc1oeWRhyq/6WlTAxlTW4\nVWSH\r\n=RL9y\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1544560245556_1544560254832_0.20170150655068264"},"_hasShrinkwrap":false},"1.11.0-next.1544656354290":{"name":"puppeteer","version":"1.11.0-next.1544656354290","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"615489"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"c90392bdf5c00fa2c31735aad6f95a70a86d97cb","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1544656354290","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-22gCeaTikh/qklJEjU4+cwGrSwWTAY/PHtdE7H/Chn2AGpDwkiLK5FCWOUuHnVGdI2DZKyqDdfDYph8DRJhwEg==","shasum":"cc661c1d292accbe76038e6b2dccaabeb2ae14a6","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1544656354290.tgz","fileCount":57,"unpackedSize":663564,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcEZXsCRA9TVsSAnZWagAAwxAQAIuYvEZ0S0r0gcttVHs0\nagK4Ayn5faB95sl0SDjXqNZQkB1axSxK8m+9qlZ0VJkyCp6OjygczPsYuJ3/\ncF0crqwQViY6rr4U4BtS/yaMMrci3OKdVAqzhNjrQEyiLnJsXT8W1okijWQI\nFE6XYOXuq/20Py4mMoP+skJYZihvvluPZrQCx20kaw9Bel4Rio5MNIOgmqMO\nxm45qve3qERXY4yppAxcEhAM4obud+5Ch6usG41kzpPApDvBQQQWrAehhM51\n6XvTdR2MV05xNpNSQuOw3KrQX01xYebPTmKAIiKCXpLOjLf+kypiM4U/95ou\n9RObBBt7ICOJ/XSzA4gv+CxDQS1gJb/Ye+0cE3SM224r6ovckBSsf2pRGZ/I\ntdTYCGZU9ElEhAIQUfJHOZ119UBcQ+hYOs59CLlGpiZjZ2y4iKh4xm8hOMIZ\nF6oDWbt7ZGpKWLtFdBaF/Ay3GTBkM+OQt981exBzBrsCAjl/Agi59BRi0j27\nqFY63SHI7PK45TVYMJO83FcotdYCjJz6NF5LaByAcyEZBC404Mx6tIrphrGG\nAW0lIEG0LgpEKpfz7cw50tAvTRIhyLvxwMcY+OwRlXbuWwLMPbwksgeBuz9i\np23oV8Y9nkAfo2ww0U7fzLVGOIdRK4mW3rHsd6K3PfJb6+5wgjIBjFn7Mzso\nT9R6\r\n=BMsz\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1544656354290_1544656364061_0.16490480154887677"},"_hasShrinkwrap":false},"1.11.0-next.1544663587420":{"name":"puppeteer","version":"1.11.0-next.1544663587420","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"615489"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"8aaca4eb1ed4020c56d03e3957c1e64e9a0e8b45","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1544663587420","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-vOhPYW3aDm+Xzb20XGJxivA9Aw7EjMauNsHMH44RDKYLM/m7plOLNK8icrP9LDNV8GRK/KYCOFoiMCGB2kV7rw==","shasum":"9d98e0071a432870fe113279f31358655ec92619","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1544663587420.tgz","fileCount":57,"unpackedSize":665092,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcEbItCRA9TVsSAnZWagAAZYgP/jFcaq0BXH51ZZo9pmUi\ntgRoR4jBbT0y+tZQcpzuFX85M9QqGphpXA6SWI8W/0wsdZsYMT9r3zenAhCj\n+yidNFWBEN79OvIdyh3B/3GIHtmiiY29M1uVzUwz7BNmZULsSk87eEnK29Lv\nvw4IvcsfnHUHwGTsEtXXr6tgRlZdWvIVrTSm0UAuBk+lUS8hTPmbOu5HL5jZ\n5QmFQQxo2oFweVip7XFQl+SgB2Xp548fP1XvDKKxfrWezgjQ1tsuUrhlTgdF\nKxpbEQFr6iV+hGQQXjBBoDjRc4pHD/38Pfnn4wx0wcNOcdbrpBo00iKdu9LN\nveCgEhc4GNLP3hzZQT8FENdeElKs4TXCzBsX5Aa6falg4N432fqvesak5lMG\nUWCNVmK5efci46+Mbz3v7S62n6R/vyRH7Z7gjMauAgjcVN30gqnbFq862cIe\nuimqj1Iv2jiOiusGy3T38toJ4q2kcbOaE9aQYdWF0wC7No+Y+67wd362OfDy\ncpExfROOosWJ8t+BzZqDivpFiN9gfnuFrwTfX1LxpMaWf7CQvbby8aF54PwS\nrlUjMml5O5Qk9SP2yoMjAlIT9jCqVEy/jw96JIlf9A4OX5tU+O7Nlil6lQmd\nHFfn0cl8wcRkSYTvnU6FSy8T4lsetFR47/pU7Lw5ssIhiCstFUaTAeqWqC1D\n7bxe\r\n=3yX1\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1544663587420_1544663597032_0.10729070393239404"},"_hasShrinkwrap":false},"1.11.0-next.1544737011631":{"name":"puppeteer","version":"1.11.0-next.1544737011631","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"615489"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"3d82465f667f0585ae8cb3dbb45ebe76bbc80ec7","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1544737011631","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-PqQL3K1Apm131dusdiwK8NdZG/jmPx5yBWvJ7FogqNvtPwx9f5s+EG/JPuOn5peWtydVy/1RFVeCBNllkHo1eQ==","shasum":"3d2f48fcd0a46a2232ae9dd3cd31fa4e99003bc3","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1544737011631.tgz","fileCount":57,"unpackedSize":665164,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcEtD+CRA9TVsSAnZWagAAVpEQAJPWL1WKUCF8fSW8v0I5\nC+GE7ESV7cvqz2aeF55BK7aCTaLYLgBqJYoD4XXl1CjLmorPtq600iFBKTYD\nAZBddnUmB1xbtAMntNSHbk+zsUW6TlUxUQn2Imt7TEd31/KGtnENnZq5fhKj\nviNLfszEW796aO2H18W8cxFIh6BoLBG/J/BDIvH0+TNAHaU6rMbvhg425T0c\nWUzczvyNtVg6zH8oXBw3yyYmm2m9EobRegaF0i/bgWjVnqWMtkuV6ny6NbAi\n7dY0iQqgYSWkoq/DkiGchrz/qN/ERv2qv2wxmPbDVqsYkBHtpt+KItyicehC\n4MGGm4naS1SI7+tQLvA8qcSVXSHl0JuT+XbA4YM8EbN5uhytUAqm9d4XlPbY\ngF7wRZnjaCs0Psmw8LcvzJ+yfWG54oaA6Mhi1Q1Bpt1GmqsoI87apFoFbFou\n9L+krmMjhf9xEab1Fd5MyelyRrQ7vccHtMfEF8giCa9Grm+cCC4ntOVQnI4w\napfSgxF0O5/ez4r79MzS+iRdIZDY1zjNDLpGfKrJ7IC+AkCcnHo8lbGeivgC\nL5Le4Bl7x9rPw+NDPTZ9raHr9e+gQSvy4NBh3b7URD9mvz0HJnt0ygCiq0On\nQaz9NqitjHrD92vDHryNA0U/l3bWqJDd5u/FjBzVirx+TDD+EHP3MVUJg6oa\nRTLE\r\n=UNr3\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1544737011631_1544737021514_0.8006491353610479"},"_hasShrinkwrap":false},"1.11.0-next.1545082503400":{"name":"puppeteer","version":"1.11.0-next.1545082503400","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"615489"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"1e66d332b8faf6a15803c0ad36178e56d4dadf7b","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1545082503400","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-lVN60oWYocM7Ih0MPqdB+7Nf8+Dpt+f9WP1k7W9+GmWE0K0Z58m8X5HwN5PGdD/PG3glNjPZG8RP3koaw2g6aw==","shasum":"6afcbdcd21ee527cfc6081e4d710cdb33b142bae","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1545082503400.tgz","fileCount":57,"unpackedSize":665164,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcGBaRCRA9TVsSAnZWagAArYoP/0dcfi2+rXh3F3/Cmcw0\n5C0apCW7weR9GcvhcXf+1GUhYwcgNjOHpNg4a4DuwNep7vAF1SW0x74dTsc/\n1HCdmIPtjSJS8TtzjYVrsDxBdlfzjLAVi9ZOc/6Lq3D8sk2hs64pOUHUyt9o\nhH+lnitep0AdnXhfwD36QDisfCE6PVRY2g7BnvGshXFBzZlfhscUV9JdI21b\nbXLjxxTOcCyUtzbpSNJz/grd9HECGZH8cFuTqjuLJATH2NbQoxmx+j3XJfS9\nmv8Id3OhWbwELZ6uZB5UKPz3BvxCRqAdvh1VMJVxsCm2zbyZjWkiUo61nrov\nF7FhfBQc9TctUK/wxGSz/ML5a5v5mzD8Y6xae195d8ZesT2tFU0hT22uN6eK\nSXqtlSUu+KA8ofsq/YjffSoZ39K434O5AO+xPB6SLQNmoywgppFnSHcPOpMS\nIDTzv7YlAP0w2H+HL2dQJUQwHCnr4H0UyiefTJqRUq3u0jcbGtUtNUj/zLxH\n5+GCJfwq/QSvXZPR8NzHJ21lg51UBc0LS0CAuVnSl9N+vQVvxOCowIRz7SmV\n8SJwYKhRpC5uYrLPC63/6r3fQiUPPkjulzkJ9XOl8cslyd3+pzNCMTeFCwft\nzAd5ktnMYgMtKbm6j9SwLWtYk4wu0GeHuIgg1ZxH3oMlMgLtmpimiMKZI1Yh\nGv6l\r\n=tx3x\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1545082503400_1545082513143_0.3000702977128513"},"_hasShrinkwrap":false},"1.11.0-next.1547047771919":{"name":"puppeteer","version":"1.11.0-next.1547047771919","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"620317"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.1.6"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"c86bc0fa9feae8ae7cd7534a39ffd500a885f8e9","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.org/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should pick the version of Puppeteer that uses the Chromium version close enough to Chrome.\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1547047771919","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-SrkNIDl09ytwIaRldzrzz+25tc2Vldf5MNTKkToCqwk799mq/pkhusW3gXLQCyGWhMzs6vkYuFR64mOi1XdXdg==","shasum":"770aaacbe38d71837a04f2e518af8b11dbb449cf","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1547047771919.tgz","fileCount":57,"unpackedSize":665228,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcNhNnCRA9TVsSAnZWagAAheEP/jX3kq4+BCppp/16MI4t\nwUUX/z7KaXWKCCljy+Fb1M25fSAbf/FjIvrHIDCcCg+GNUUsO6lJTVRfSDLp\ns1J+zDtYuuepuAVd2s6k5ALpZtUcHRf5rA436Z5r5kcRK2FjsscHNkJR2DHc\nCeYxrfAgzq0riPjxZBdC4eqoXQC02UScHKfOLTPapGfB09N9oUaFIWJ9wjHe\nk02cmqIttVuskWSGJ61ERistsaybI9qk+kbUhS0b4Mq627T2CKcZJXIIx2b2\nG5QsefgfVmSSrRraN+4mOEmbqtj64eYWreFaUutyiYfhhUzm90ZzECZEK8I3\nF/Z8SS707Fv4eyqJCRV+2qJqyzpLuf/4iHwXymK15gy2qH7Dbak+IOh2Wc3g\nkss8e3Ce2RYqHFLbAq0wK9ApTMGIR0db/E70cg8oewGK9/ZSIo5hlQrjjJUk\nvzMmX523oF0thJRMqSdr381CCS2Ns/AmRZUA/TtsnASIVHAZw1J3ZCJQ8rIQ\nUhCOEqc1JCP5kJOvRlBL4g49M99g/+6bRSZMC0quIP6hrE6rLVrn+h4lIOzQ\n6LebFbmsMlMZFHuoBsW7c0CJxJIchWmJwQUKTYkrXNdSsvoaaBWYBRG7L3hA\nWCsm2Bswqe3HJpUakeJ6vLex0POJ8pvKrqapDobk/wMh745iYcyvuKV3bYqK\nanXc\r\n=8vI1\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1547047771919_1547047782278_0.2958998768720069"},"_hasShrinkwrap":false},"1.11.0-next.1547510042445":{"name":"puppeteer","version":"1.11.0-next.1547510042445","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"620317"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"02ae552ac4b07800fe2c8043436c8ff5c39c90ee","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1547510042445","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-D3qKuKiTT3e1EBej+j524HbcNauzxh8PCs98cpefdt1OUlyjF04DlAqqFf9LbY6NiRc7WIctElCq7xxdbkgaNw==","shasum":"cf10f47c10d4167c785cfa6ced1021e11e9c5d00","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1547510042445.tgz","fileCount":57,"unpackedSize":672405,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcPSElCRA9TVsSAnZWagAA7SMP/0j0Mrad/xZ7WljWrbdY\n+OUZGRs3EanBgAUrutSfl/q9xnUBdENbO99uzjxgznC94EGWNsEOXgEMpR3q\nXPsYQmGAhaeZmTIi5ez7fPDvu0JsgPDNHPFYqs7Itj3vnd89aY0WI1WELQI3\nJkoK55gDZl7D9wLxvyRKTNuGj3+s5N3vs9kgyDGyE5uteiCjJCPrNcX1WZRn\nwp/rc0LHZ0IIAD+MA54UZGdMM/j0NDQz35Zmag33Tow17JfwwStfL6pUtuZz\nlc2kktXHJ3GHrQhc0oxX1b+DA+MOYi/BqXINGAkZSDWkMtWdTCkZybIc2Xc3\nv4f8CLheCRIpzFHvabZ7P7d/5NEG7kdgOXMwPJTgeT+nNTWMXcBhf8V2XTwa\noUamowlcujjXJy66T8Zoo1yf6II531ynhbaYD+YSqtMsSZk7rATKpYbyd40b\nienJoa0SrExoM5I70HSkZR9Jpsuy0nNB36KMMAJw52EzxyKqUXIynBJ5FTBc\nMxvGQPNK6P3gjP0r/bFAXX0ov7I/qqg8OPYvzZCJ4XQPue2Cp7He4JAznwD9\nPnXaxWue5/nR2Dh7fUyh9RCudmye2h/DP+sStfHNorKu/LjJJkoHfujnBCvi\nbYXM8pdpWxuERHT9y9PmaDzjAYptBnZiDzdgPneN66h6/XejZT+aFy5dSIoS\nRmqD\r\n=Nrqt\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1547510042445_1547510052969_0.03123507789638147"},"_hasShrinkwrap":false},"1.11.0-next.1547515612329":{"name":"puppeteer","version":"1.11.0-next.1547515612329","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"620317"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"9083c111caf5663ee534ff5e30127027d424974e","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1547515612329","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-xSK3/n1uVuUzW4twzl4Bt5OgjtbglsOjQwixKrXu4uhUJuvjEnDwLkPZ0zQ493zZB8WdQ3c4sxYnNhKMUg05aw==","shasum":"a5c3f27e2aa31ecfe91dbcbbc8430ce7a455b567","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1547515612329.tgz","fileCount":57,"unpackedSize":672757,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcPTbnCRA9TVsSAnZWagAAk3gQAIQrV3EtZeJfVNiBnGrA\nO8Kq8y1+8mBH9MNwx1IWpqUnmtTVv8MKWb+PChYOn1krFHC//mMNfr/MMqQ+\nuQcpn2+9mhoCxy6uKJHm2lPgaCarBAqpYiWiDr+blD6N7NiIj6eqzZ+LUvRN\nQtI2haQRYAavu7O3AFzsIHYe5yAGrz2/H+qjqGxhi2ODHAoHQ9Gfcmp9DSpe\n2ekV8FDTwqkwjqm+DYTjaIJ2tr8hHhaqK2MEJuD6wkug1fYl0zGgCjJk1+k4\nUqW7k5YUpiS/YltypsWWixbaSeSfrBHKlboTSrfK3qKiK104epAaYJ1pr2wH\nxgcTyCMemPhw3BBMFuQBIeWWRSo386XbYCWkgo+IZ5Hxte1Z7pzse8ystpJB\nxow/t+N4O4Y73/rLG5YpXZ8XQ+NOKxSCJz0s2ptFsugpdbUVVv+NYfWT271Q\nmP3/wZ5WwRecYECGyqOMLVZeuuRvSqfLmS0Ck5RtOoUQKcbZk8uFLao9uzB1\nUlfwQpQGv2PrjBeOsX1YECAab5aibiElKZjFDSqQaG2dhTda3Os4spY9s6EG\nzN6rpzH7Q3oXyVTyNOzOLaTeiFfucAz9TLU6SuBo0eRZtYeHB77BxiEZfuWv\nYdi9BVAphFbKm81TRE3Yh/Fah+0CEGaUeyKFxUYax7Akk2pAzRzxe0tY25Xm\nUvNO\r\n=TNXn\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1547515612329_1547515622696_0.8794058626350465"},"_hasShrinkwrap":false},"1.11.0-next.1547520320509":{"name":"puppeteer","version":"1.11.0-next.1547520320509","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"622472"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"71edfc779bb1315c57b8c903afa14a8784aacfed","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1547520320509","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-ipklZktPdFiCi1UWo5y5GUH/K8qJ+PQcgMSu169FWPC6Mrv+sEMWu7NP5iMVgs2fu3FoZIG5LV/u7CmFEA45WA==","shasum":"0532a7c66914812117d5ecac21ffe98979d767c2","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1547520320509.tgz","fileCount":57,"unpackedSize":672757,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcPUlLCRA9TVsSAnZWagAA0soP/0OWYEci45FcUVcOkc3S\nNHtWG7NjJpdiHwSBn0x2LEkuDbFfhkc1rFRQCmFqYb24AyRQTNuaoHIjOo11\n+eOQrZVuL7NMms1DxSFMRODEnOb1jdw8tWZAYYZ99wfOXle5eIYPDhf99Byy\nPUJoaSpd6i7ZFKjGe1NzNgDMw8OwRrU5zeLZ7LandHs94JI9ypR2beF7z6f5\nW+cjsJzEZdH+QDesp6PJ0jviZ3uAx2g+8XZaT+e6zH+DXkhz0movV+Q9K//2\nd30s1leSO8pHSfwVCYXVHNtf0uo2s2RhyriGgHRYusqvoTyjC5porHWfCQA7\nT9p+t2Xrh+77bRSRkJMkRr1+RLHLWSgj0VK2gbB+qffvQf/6cBVyaNiQkNYY\nTqFbqvw75DYPU5shdDA38towDuZmgwwjRDhmr/h1uOqlydYPOifeFdcEQaj0\nTE4eYrMy3miy9ed442otgUf6ahlApQfjpobbAB/g8K+uJCO2eZlQrXAqWK86\n6DSXn4Fi6/EExhgyJqPHrpl9f/lhcSJXBte1OoCtDFNvB9GMUcYviO+Qj/pU\nIdKV799YpLdgxy35ivsDCcCsJCgLlu/bhw1a82KBiCv6YleBcQdDEBM/VaV+\nzMjt179XIgCaj4XK7AZ1UIjjkuMO+CpmCCigla4IFGtRKQ+ZUZSb7uv3Y6eL\nRquK\r\n=AvmF\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1547520320509_1547520330849_0.11684753708262585"},"_hasShrinkwrap":false},"1.11.0-next.1547524807357":{"name":"puppeteer","version":"1.11.0-next.1547524807357","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"622472"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"4e9e3bc614cd20ff0b601b8530cffcf5315d974b","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1547524807357","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-xFSjbCWgPvS0P4MtQJjT+RYa5TEUTgoQllpCawmBQh8YwdlEAbS7ZyxlWeUIwmy45NyJn17HUGT54W0vrMM1Vg==","shasum":"a360f025fd90c30d88c9b0c8495157f823059508","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1547524807357.tgz","fileCount":59,"unpackedSize":674875,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcPVrRCRA9TVsSAnZWagAApkEP/2VU/un8ild2gFQlZ+9y\ndqXI6cewUj0YesHtRg7jQnJlS4eG64P9spHLNqjehEqAbtObOWFZ0jjLz7Ps\nWqcij4fwCQRTcFrhJMVMBQ9LDLrRpA89oXltDIfcK20gk/DHsJuycivYw5CL\nIO542cnq7TFDDLfmLEoilmrP2J3ekJJsB8ci8syVUMTcsKFW5Vb0109+NKzz\nPGjclM2fGhBF1xSX6Z7jpjQb1Uty3A1PXQjPNTRTXnbYDc3A3OTQDJgz6k5E\n3Lq6n2Jp40jTVJPrb2UG2V0y9C7aNBd40T5J1cu5uQVZwX6CMHzrdWm7yd9h\nT8Q4sOvueS66M0pieQMahqM6dOs12vH6z5UIuZWz+V/haySdef45kXVo7HDC\noosBbzW9yogmLM6tmQwunOGkIAIZhFrx4shotcvF1iNkPi25z0klp2M0GloZ\nYeLSlNHe7BbSch8h+2J6YaOfre32Z+rVMl9RxEx6AlwkJRi6jXZXAlpm5XvM\nkO7/Tuy6QmtazO8ipWx282srOlBslqryCp4scoJNBWGcZc5JBo7OuXCALjfK\nmTuU6KbJAJXysXNzj55kM3+/JmSHF2SvV7N7iX5P2LdVLLow/VTke9xI9Els\n5sw4I8dtQKXwQWaA2DGq7M1Jl2suvVyJGZi+ZGhrKKt8WeoAkx+Tz/UWG545\nzLzU\r\n=H+++\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1547524807357_1547524816923_0.44602279824461744"},"_hasShrinkwrap":false},"1.11.0-next.1547527073587":{"name":"puppeteer","version":"1.11.0-next.1547527073587","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"622472"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"e8bb26eb956fad53f59da315374367671c6c8eba","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1547527073587","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-w84NxHajEV5z7SvFNCDofvedhsK4JIt+O/OiW3HTI1WI67ptkwFB09/z+43Mey9qn32MbWKVrUeYN1F/4ua00Q==","shasum":"c24b12526154e7b5b016d8e28cf2806bb4b9965a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1547527073587.tgz","fileCount":63,"unpackedSize":678151,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcPWOtCRA9TVsSAnZWagAAlM0P/0K4RsAoalwF5J0TMf47\nyqTQtnFVaSjjWU3ZoZKdrrG2cNXePfQKdF5C5aC0DC6gslScuCoE/GCUC/eH\nFNl2Yi8bmQu0fv39v4IkY6eG6enrxc9SiDYtaviwNNe+yUaYcSwrnhUPXE4h\nR29KdYLgxy1Z1jAqgahB19nyBTaKUP3GddVdBb51lXfR2kb/isr/ZqylNt6J\nm2kqs//H+14D5qwqRUcx2Z7PK7ZqFS847Fumd9Tmubn3S2U0w+SXzGmZv9h+\nwLLbnECiut4JusK4oUWadr0MtQegmrbD6qrKHRJpnVngjiTQKNbOe4iACLwS\n46wwzz/EIr5VYyBS/aOg7XXpN4Ycu+UTFN33nTEUcPrxnNsnDl2UvWWpAldl\nHIVn6Gveqlw0MEpBCK4b5KCXgzJIT0fXT0Pc8JvP+BMkH+3XmZU7D1DzTfc4\n0gl0NppGpuqiNIVT8JZNNdV6LAMGUUPmQomX0/ACxycA7ohiJwzS5lA/cwMC\n3CRrylN2SrXLBUlNHKzINgursbxAXP0KeY1BebY2f/dGZGvbinwLaPe5n/55\n6Vyz5CrAaUkeBx0B2AnG21voHGLIir9AoXc856HK+nu80g63r44CXDcGHwEE\nySSkXj//Z95y4cRgxYevusd2Kzn2Dxs5kWAkUJ1nClp67J36mN7p9twdO5fX\nuD4E\r\n=zyZK\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1547527073587_1547527084517_0.34042845561264"},"_hasShrinkwrap":false},"1.11.0-next.1547581252732":{"name":"puppeteer","version":"1.11.0-next.1547581252732","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"622472"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"04fbbd7cf00852fa5b8ecf878f7cb34c9796453d","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1547581252732","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-MIsFTqShmt3uJWvxtvV1omun6tekcMTkEs/p0Gds+mX76EKT6Tpo74/+tTqKwW5hECHgI2UJicigygx9aY/qQw==","shasum":"cd3f32e447df51b5eba96a833c9f4092d22749d4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1547581252732.tgz","fileCount":63,"unpackedSize":678233,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcPjdQCRA9TVsSAnZWagAAnAgQAIxAq730UlU8XVuBLH8S\neYIHT4X8AEICSIGjOCM+QnV9ThwDejbBIYtcs4+aGcquEy/UHatVrcM+xUxA\nHyRo7gpdKwsmt3TScheb932jBWWa2yyxQpjte35hJT1R5ymqJ05vcbebkj0N\nvK/ebJwPa/GIISDAvbMdfzHb0oycoMDZ0m+8YI6lhfTrmBc5/3dzSXngKMiw\nUT1PveKWAWJVphpCglVzC4lGT+HHMzAvVjCX/W5t+srT6Y1lN3O5Yr/jtIt2\nR486rvxjbMnApEVYgNPrs6uz9vM2r1B0z7yWAMJ/KtWu7U02vZvkrqDfXXia\nYeuyBlVzLdxx3aKWD9CJKZ64ZmVeJctSChIkLgL0Z2Pl4G8h0NxAn+J9v8/4\nI6O8e8abPLYw/b8s5n24uHeT8/pTe6l7vDw/LPDr33GK16E90Gh/oiKPmpqn\nUf5sFdn0rhDxuOjSLYY7B0AnERBBfV/UHkwerboLNxkxTiyRJqpgKFF7pAT6\nn3/L+1DcK7ff8tZAsdiH/c5JxNl0qhksZ6pIp9f9j2UK2NQjXAM+KnbVSs6/\nAfPwGq3Ue/TAFiQBYVFU1uihB7m1bbyx4QlOHC1TYUIm3wmXDRLbtPN8xaNL\nAZKzYqUQWgm42UrngaVa1rbTwZy/RfKTvJ3WnFDDEWeUguIfbwV9edMvEIlW\n8NR8\r\n=aItG\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1547581252732_1547581263274_0.26432907629194835"},"_hasShrinkwrap":false},"1.11.0-next.1547583689219":{"name":"puppeteer","version":"1.11.0-next.1547583689219","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"622871"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"e5741902b88b7ee31ce504c33cc62e405f73850a","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1547583689219","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-8RC+RzGjScTCZY11X0r0lN1Dzk5a2sOq6wFE7GOTsBGcGUmF08LrcGlRakurOLtRbNY93LBCyceZIUXHF3mwSQ==","shasum":"d8551b2514eba019e8aa5890aa4c247426da0e50","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1547583689219.tgz","fileCount":63,"unpackedSize":678233,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcPkDUCRA9TVsSAnZWagAA79sP/0e6BKzRnSKMJBLK4EUA\nSEJkGljcFjiIu3XAqGG+Mfi5WA0ZbfF1ULc1Sry9j1/qV9D5qrpOiEua3GCh\nPAmpCMrD3n9POkc3gbXsZP2yRNYsV4jRltMjXh70KdehVg7L78kB6bGrKSsQ\nW0gC/4aQS9Tw4HTfhoy/ATrmQm2L3hfMZZf97kimODLWH8gp+DNiQ0B6RImL\nTzGBHGQTj1BPaBHYtj3Lgbp3Gwi0PMx5QUOC315YI5chkHti7O94znUMNOaY\nChWsGV/36pCNQm/AaP4QxErgUcRUfgc1Y9vQYvmEY5pQ+zHVrENNje1GEW9l\nS+W/J0gT2vlVdyqoYV7C9pSpce+LNkstvQ23jyuz0lcxkuc+oyGcAzJbAHiH\n8q0b22IWm4AmRNSmVVxYmdfjXSzJP66IVMhdLNcppU4vjZka5/ayx3bWeW5A\nYnPPSP/Vw8+SJHOL5xwkiQESwwFdWabW0EE87iiUDzm2V3V7eNrxWmin2ETW\n41BAa1youDs+Bko4+SJlXB0EU3xU86YDurdj02flDDh7xlYD5i6P5jEr7agz\nmja9M/V6lWbCHpAc6S87JqZdCoAdcBu4KS7dI4wKZGMhvrgnC+E0Osuk13l8\n1q5+GcrCbHb1abts+CP48X4Ge1icQ3CU7zDCAweeK2BgBfcfYSdy5cpC7PnB\nX0S/\r\n=w3K5\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1547583689219_1547583699523_0.08132943932140146"},"_hasShrinkwrap":false},"1.11.0-next.1547591862863":{"name":"puppeteer","version":"1.11.0-next.1547591862863","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"622871"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"4e1e2fb7016b4a5b64f9c6fea524621ba21c2817","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1547591862863","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-yRL82JUFTCx+ihRaxnHVz7/52bTs9j7cPFkRFKnlGglr/TLKzNFN+7P25ksStnVIfeKt6YOQh4aJWMxBIVJBjQ==","shasum":"5310a8192258efc196a37d63f49bc2a9e499a9a0","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1547591862863.tgz","fileCount":63,"unpackedSize":678739,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcPmDBCRA9TVsSAnZWagAAi/sQAI10JQWhFFiAD6euA2Qh\nVEyNOGXpRr54CLN+LkSuCB5/Dm+X4qqljfwhjvt4m/+WisXv/yIJf+/BktwH\nFCafhxxD6KCaK6qO53pXsn623Sar9g9bMxSUH79Kj3CoNUDFh+Ro7phKRIto\n0Nq+Up0zv3zuloKfolJdb6p1sTVHleLzk6uWuhWPUMFlHbiSTJxIJSC9p/P4\nVCUMzmCh91jcHAKpXeB0J+/Lg3ynigpV3LYy9NRn5G2jzbsj/AuWTBcYXnv8\nPqBNABB34Hb81FSzVKIUU82DhaalVqz/9oT45FhuMYIdaElkLjib+58imsup\n2xK5dhD0Mw+at5tgTa/Pe3jJy5u434b2VxApk2EAHVg8YYHz2zHY+Cr4SOAG\n5csQRza92dPzmjgkAqiX3+OL2du1aaVXVHzF8FXPxTJ5s2QiS+stcZcdg+4z\nnzh9JpYR5FVMrjQHBPY0LKdVUp+06c8UepzgG62KbCJOGHZdA4Wf8KVpzBiE\nYnG+O0hCmHMUKmFuIp07Jp2zzv4S0jNUfStyiZINVati6bS8EjoyDBaYfDFb\nlUUNjtVJIJuuoOS3KVbGsTdUtmKOvMGHj3dbCHcwsZ6/yAV9NHpVggmneeBt\nCmUvVSnbNYvjkY1VU7t8WZGi6MxLdSlEQYoRf71t6as75FBB80i+luSnEZCa\nhZj7\r\n=Y5Pz\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1547591862863_1547591873052_0.8544093862206559"},"_hasShrinkwrap":false},"1.11.0-next.1547592776490":{"name":"puppeteer","version":"1.11.0-next.1547592776490","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"622871"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"91c4501cc66d3e00156242a196d5f9f925609782","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1547592776490","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-41xJN7nJVEpHt+yPr23I9o6GG+tUuxkV8Ql7sev7Qfvk/oQl1K+gr6XPUlYvPNycvzqf/uDUfz2xssvMFoSt7A==","shasum":"c9a2dc4e99c48ef87c81440a873495c8838eecbb","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1547592776490.tgz","fileCount":63,"unpackedSize":678739,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcPmRTCRA9TVsSAnZWagAAkR4P+QDqwqT8mHCL5RJwZH6e\nrbfsdi0vTkkZ6o3wraGO5lbgvWy39+WXA3LrOqO/a8S2qERGvYdNNd1lFaC3\nXqaruHqiY9qGtziIBh7r5HeR7cW9DSyOaINIH3Y0HJamT14Bv8kzqS52jNSV\n28sxdUayMP7HtBmZuaD5AhkMCKN1FoyYLchZTeCO49XQiV8P9ok8dYM7WdZF\nUx+W7yIOImEtNh5fEIMwcOyvQfrjA/04mQvsq7ng5hlD+Ydngm30N+0YN/R+\n1fGoua9HITKEft4hwYHoR2Kva3BRTNaaUn+NAF8FY9yZkeDGHZr90MMOAvWK\nJMZDYOYUbGNi4H1dowfsu4aef++aLgQhtIeeeVaxPy4IXGritHlmuDlbzwC/\nNqGivfbMG009WBoVSvoMalsrNZdBEIZNg3+jT6zzuobwccZ9sMHJMBx2vFVQ\nxKsvPqGHn/NbOqkmsTEDm5qnsTdBHkqkyAcfyV2eUIGsZgezikPhanyvxWc5\n5wHhTnVoQTuYqMcYrS1tqu+TD3cVPJYs9lEKiGcxG+3VNdEDJLW/0yPHM3iE\nlhODjcPI6j+V3MBmq551OcJrfjynhDlbC9Ymll+9oMx0yYGfZ1o55Jc0Lj2G\nScmfTI46WqoD6s1nNlCew5pvhxpqJhCd+uOZ4m88Sn260XNOtH1k7TO1bwjS\nHOpq\r\n=jB1g\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1547592776490_1547592786879_0.10117074457561581"},"_hasShrinkwrap":false},"1.11.0-next.1547599456407":{"name":"puppeteer","version":"1.11.0-next.1547599456407","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"622871"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"bea26a7f58c3c46912fbd6555fa8dcce27fd9274","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1547599456407","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-MPL26IgES9ZLbotVsfU4xWk0avi0fNaO3Lg/G6pIvrZYRE7GO4gRNjgdXoSvHE8iMcZ+T52fWsTEWBfr8sJ1oA==","shasum":"a84525fb55c6b5eb38cec4911c8d31c054215211","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1547599456407.tgz","fileCount":63,"unpackedSize":678739,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcPn5rCRA9TVsSAnZWagAApvkP/iLYG3vs0kBuu8unBVvR\n5XhuaLys8gnrLE5/+EtQAGVF73LuWu5mes8xNsQKyMBj4tvfAU7FqEtJrgk3\nWXtZm0uCDqNog1lh/y/R+iuGn6xzUZT2g/T5MLYJDtiZA3zN4fn9n+ItvBk3\nXlg7wtmfMH4RsKlnvlz96vQ1G613UvwUJYykCWeLKh4MxR10eSj0QwrM29E5\nck2CqkWsXvrjl94Jsg/rMMZpTuaBrVdo9N6o8vwuYGiX/v+FXPTe2C0weJLX\n9AS/128MYs3ie8q8Z7qjrfQ/h8U7w0V1pgBSXCxIkGdWQWg8lkTOmN1MpcCD\nCf93vyB9JZ/0cjaw2ayaE4aGtZ0UUXrOkHdwjFnDhJDOGCTJIcpQqJwgPyp+\nXVsVXEEJ73Whb0xI/ZKJIvyHX5f9vf/5XzGpvz7WV8ia3cey8EtnjnU7SXL5\nam8Eaw6eZDkxsu512ejVVuG8X4kzny8p/tSm4ymTOvcXskh7ypwwLn9sPck/\nNIQBROnyeTXKvsKsnpitFIf3GU3ZJyHOBXwQ0CA6kpdk5NrK/pWKwo8Iah6g\nUmdjRsK0eZOilHg4AQxIoPgvzEMBo0+x5ouhQn0VkPzVKMm8z98pBI3LmKt8\n6hoL+LAMSVCYJL36+vDouCsO1iAnC0B7VgRJc8uT8V/5adgOWVBCs637GZJ8\nUrrh\r\n=vk2N\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1547599456407_1547599467149_0.20524866585362433"},"_hasShrinkwrap":false},"1.11.0-next.1547601875361":{"name":"puppeteer","version":"1.11.0-next.1547601875361","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"622871"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"4ac00caf9db30b3883e0ed3e5da93160872c4648","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1547601875361","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-YXLFpKIKWwqdLnknzSgLus/s2+Scfi/WVnd7ESKoKbIY7NNlD+FCvBxG/JfA0kKcxPMThlYDMj2HXZtP38jw6A==","shasum":"83d1b50798adf89291183d1efa2ab6436183a11d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1547601875361.tgz","fileCount":65,"unpackedSize":700973,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcPofdCRA9TVsSAnZWagAA3HIP/2GmDUp5PEekK02r904L\nm7sBJn6HFjgy8o00jFMKtJdaZxSW/ecE8LjuRtzbJlL90gBotfwvJZaB12xP\n1Gpab0YqtP6oPFSNgVE4/CwYOoGzZwon1ys1VKNdWyaiHSdA2y++7wY3AMHy\nSPnwrwnoK9DlJzrHl3HtvBeomEczkEKmLZSEH4WoXIHFbIXIkoKuWevvapHI\nij2OQ3jSdbd9UFU73bO4lUbrMwfw5K/W+rkeRz2MtDbwHhioXvpJDqucPcgN\nfdze3i/DtkqeajtDRo2qlwD1LX5B/ubnciI4/HCdY1qN+UkULfqEKr3FxFDd\nWITz4RF886cZYxuOtATtjG3D3nTxYfawOYpfLmQP55jJf/hWNXD2QJpQQ8eh\nLs/Op1g4s8cjzWhPMYLqfX6jmEMQSCpJ+vvQE8gYUiwDfTQl/FhoYxrFcdAS\nbEuWPXD47Ryow2cod+/XGE1cGLJ5YfeVU645PYNo7ETt5JokcILFXYIZWZeI\nC25YCQ7kdzOyH0YYIdYLFZJpF4a5UaRoySqoNoMbEem18bfylL8xt3//wFGx\nwXRn0xsXcP9ksailzMNN630UUL1lIMRB9LpCmWIhDsITe3fjh/mn170gP/6k\neDqXEFOlYKylFzqcthPuRs75koNpmB/0Ar+Gbuhawnf2YXYotlSApSrtYByB\nfveG\r\n=m7IU\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1547601875361_1547601885419_0.9739441465628"},"_hasShrinkwrap":false},"1.11.0-next.1547624594064":{"name":"puppeteer","version":"1.11.0-next.1547624594064","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"623082"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"f8615c84b515b1a30bf2ce93c0a0f00c7406d621","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1547624594064","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-aQdJLwUJkI5mkF0VBWxEdy2fy9hYp837oslzP2Wu5y5Bus/RWKWA6ls9HMs/7hLAh++EX4hOlzikFQgX9hnZxw==","shasum":"7aac0eea070b93453f0f0976a59d54bbeebfcb7d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1547624594064.tgz","fileCount":65,"unpackedSize":700973,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcPuCcCRA9TVsSAnZWagAA/XkQAIl/dqFlbYbSVkArSJx3\nwOw55B5PANsrrdlpwJaDg17VJUPVTUm7psDPPx/LE65Nno/gUQ/zFhc0XCGv\nGHfyNVVW4IyRyoERDrduD6C8GGsD7Fpo5IqmzWq6xnzOyhkO4eH8A7UhzhOG\nCmlmGONBmnJ7FXEu3iDQcua/H+0ooB3A85xVJpcPPSEt9eTOANtgpc+DKVSb\ntdW3+0XSzFUuByHmzm95GefmjW+s/wlUq8oAKDUiIbddkQAV2L2MmSgsSKXn\noJPaDzHfoX0gz7zTfrRVAALCDTNVmjLCyWWbA1XzDNqWHlN6rLmvio28HGKy\nOaf2UUrmJfEUIfi53L9uR7kxYi7KEVAML6lIpOS1QLg7TKowQXyjNR489hfV\n0V+2yi/UDMKU7AW9akLpYETkP0albUlBoA1m1yV8hevK+L8t6mo+4+tuHQxN\nEo6GE4HhI0RccUyHdni5I5ES5aYdnuds94bspFgd3k2PGH7UfomFgen7g6oC\nrL0Gv4qAwNgrT9q8uBlBTmtNdMSA+KO2XA2VXEU8c+Z7Ckj5J7JedAGky3Mr\nqIVHKppf4cKDqliADa9mSDhICselxDjQymaCzcbjb4e9lAx19WOiF3Mbf/Re\nARYKQe9GKsW+9kjQNfczMX4rnLUiWsWBHNAVI7d7E/13Nd85Cs/m1vT3ghKE\nhsC1\r\n=Px+G\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1547624594064_1547624604207_0.37905399097936177"},"_hasShrinkwrap":false},"1.11.0-next.1547835637594":{"name":"puppeteer","version":"1.11.0-next.1547835637594","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"623082"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"a9ad1c386b72a693be774dfb07402485e1138d43","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1547835637594","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-hP6gPV/E4LeVy+h0m9M6fhB+R8Wr5JAoDaWyq8dkJNPcUet0d28D7xMn/GrQ/8uG5JF45Iqb7y56bSZ4RDFJyg==","shasum":"52ad2b2d8453541af189a7c74127e600ba71a6d0","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1547835637594.tgz","fileCount":65,"unpackedSize":700973,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcQhkACRA9TVsSAnZWagAARK8QAJikcXAScaCtrobikrp0\nNN7qPremPcmWSh/5BLuHq97P87EsNRQHLKzscoOFTx6cvMUPi0PBz+UgVjeY\nLKudpkSSzvt8mF87QFPmtfpAdvleqC08hHRETBcf3aDUFDKAyNTfhQ+Nw/xn\nUfJCpjXsz5uaiQ+qglwFVwFp+WLGJVWK9HdJ8TsyCMJBfVV/qyLiJTPKyX2T\nSbidhmfyaI6H7n4/4EYGAmNUrB2OigQIrQrk6rXaXo/fYG6Rmbdcz3KYW7Ns\nstfaC866cxmb4ybG96sWZkTVZLtE7r0wGz93I74RzcXj6IFNF9RvG4dEYfJK\n2GUj2tScFh9zRynFXSehW7UBekd8Ft8r3ypb/OxCZ9FWw8DLkSLnWK3dsYfn\nAc23g0jIDMuol1V80VPI2/5p3+Wldf9WdUAW4TWILN//kdcNKzkSaiK8oFwq\nf2sSHQPbaoX9AOJYSTct9kz3jzZJkAfWL7mSEFiiE6VAT+XfHLq76uzqu+fJ\nNZFV/LnsirjJi4bdnxSYnRoyD6R9v0iwGx/5l6/0Fs8nXk3l3pOpuKW7DlJ8\nIV+EpoW3PmQ8tgmS5sA1V4YSi3Wy+giSfMnSlb9vu+LINNUIhYDm+wZxbqbb\n6P3/rwU6TVMRmW0A5EsIFZ0YerumlSs1fvyIYJHoCYdix3G9c8g3QpPhzDK/\n4w8q\r\n=sVK5\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1547835637594_1547835648366_0.5587313973689501"},"_hasShrinkwrap":false},"1.11.0-next.1547861804321":{"name":"puppeteer","version":"1.11.0-next.1547861804321","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"623082"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"842610256c1c7fe77cbf7e31bb4ef98130d376dd","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1547861804321","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-L5W4xSpyckPew/yJVvOnky1aqwwbPgH54OwZir+W6k+Ynt2HgQOKXWHenv1kiKiNvAf8XmoPtpTHQNz8I2yozw==","shasum":"d9c7147ec320f7dfdb7e7af5e144d54569063267","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1547861804321.tgz","fileCount":65,"unpackedSize":700973,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcQn84CRA9TVsSAnZWagAAb0IP/A9l763rjuuHxwbpsp2O\n69pZO3UY86MbTTjC/XKHkoBDbzml6+8yS/0U08/NGuNEESd058+mV6Zq5N08\nYICCO/9kTWkXby+eW8pZ5a+foteFHvyTh1b4t1STE/zg+8nWv4caQg+lqUiw\nHtU/jyNrpF9Z7x5LbZJlfQ0qAmDZnKGhZxgZzlv4eaEykUD/Dhs+c6QqhXqk\nUMHaEggZ41G2QHWmoohnQv+N02C/llSc87DgghlFQqG86g8h0LJNls6LohLz\nnBv/P2w9ldAo+BMq/623KPiELqaT3r57SAXJAdnbeQIQDaRT4Q9XJDJUif0R\nBkfZmmIrzZVAH1fTXOFRpdEBgDuGh1+loV0gae6ZdSHpiW1r1+51Nzb+Y4Aq\njS0KSoVZh2Qc2Y8s2Eure6VrNkaxJy6whse8ixVtdUUHCEEH0QOjpyfj2hmJ\nUMC58cASw7kpntoM5wI1uDONBiBJdu/mRVhJEhiSEhInX3sSD+k19zaplYmu\nyg3Ng1pBBLVLyDBjkE+fCL6wsUpE5RJ2yrSpDiAhdjNnrJ0ivMquqfHX4od/\nuFlWM1nsnVhraAisCaBJJRRhIds44qzhRfKRRXcBlYlGfPJSfqJ51XLb15WR\n/aJbpgT3Maaix74YXpmGhlcY3Gau+nFzQsEbgrwNH8W+jXQpAQT3SqTttl/Z\nRRyD\r\n=yN8b\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1547861804321_1547861815320_0.39075437352144626"},"_hasShrinkwrap":false},"1.11.0-next.1547925461836":{"name":"puppeteer","version":"1.11.0-next.1547925461836","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"623082"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"c48b5749f520d75239bb3ee54aa0e300a6f6d866","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1547925461836","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-VGN1to7yd6ct1pqHZVQ6nBI6r3Xq2NG00YnTywy8PXlqY/IyOn7+l9MFm4CUCh8R8YDoO9fwKONxxzjSQ6sUsA==","shasum":"7f910e020894c6dc9fc67db2e4ab889f32101f11","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1547925461836.tgz","fileCount":65,"unpackedSize":700973,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcQ3fgCRA9TVsSAnZWagAA04YP/ighXpYwI8DYDaGkwDcc\nWXxHChXNZCGycj1gTBWLOiVb+Z8hWZ5ieY2WVXzMF8yuUJ4lltACWkUvtClm\nNxtZ7GfFbXmzYr+qeS3t2hXxuhh65ZfIeB5XfApKmskYE+vhXbyqsTjfCYpV\n3FFlWRdGK+jp9mfpRoE8QT2LIRcfkU+ooQc1+T0EaJmQiH8JaxHc4wNSmIhh\nAvbsjfM1U02xnoebA34rMo5BXKe40VlfG4UCrrNqhhta2YSVcxsrlp77jYh3\n1UMSUZQg55oZqC8tOZbGbPe48hj+aeNs9Cgpltj1tqu5UGh2DzddvcAr2vR4\nZuXzkZnnqFXZXThVFLrTcPsheprHdaG+xZRfNKJ02aFj/p+tuy9uhC2dA3EO\nTIk4PldQMhRvtjkYkw9vBzCyqJaldHs5dAZW2wSd93BCPPh7ChMJhzqtawDs\n6sKFosy22dTlkNqcRQgcyeysbCbi6ULK9EZgEjquq5jcSk/4ozmGLVpJakeS\nb5XS79jfTE8aOFv8vFVUJJk6KwwGgtPS5EfVPBvpm2LguJY+rtSs/Cs8lkqf\nsOqW1rovFev9QEtr7g9IM+hhamxopy1oaySprVlGCb+WG/SL7qpKYSvgW/8K\nNxEeQ/uVZzQuVBG+SRu61NlibHQW1hboAqLQfedoIL5XODNLWredg/zg5pD4\npLPh\r\n=u74P\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1547925461836_1547925472076_0.7532606074041113"},"_hasShrinkwrap":false},"1.11.0-next.1547960730125":{"name":"puppeteer","version":"1.11.0-next.1547960730125","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"623082"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"9fd4b67d0c6597f32a5907f241f081add0d492d3","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1547960730125","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-h/JZ1ec/kGmKuCSNuiwA+xiAX5ECJQXAHlxwrtuJKDtg0CkylkaQ3RSKDnxoWkhtHlMehSJB24bOE7lBD0eTfA==","shasum":"d8e834181bd3830e05ce46c09686938206bbf364","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1547960730125.tgz","fileCount":65,"unpackedSize":701005,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcRAGlCRA9TVsSAnZWagAAWyQQAJrbhrozZwuVWhrH6Fs3\nAH/HY0qcVUupz+MDR7YW7TM0wJD1IH30QXLC4IBA8DlegAy/j4mSJGW45pVz\nbe/usnQvtcO1+c0WVsYHoJCl2Wh8unh3AiiLYf2A8uHEG8ZY+0UaAIBM+xAy\nAlRAQDcml8062rOBFDSjiTVi5b7O8//R3Y9139sqb9Ohg+/VoRwBiF753dkl\nslPVN3GqxfuOMHDKh3Qq86CgR+j4bleO159yT8AYzxg7hYLXZjinxABrRBID\nT5bcdXUeRosAEz9Vp7nKHsbS85g6Q93OYkwoBAjJXTVzRZSKf6kQWo60Oxhb\nCafzWVgpTPXMQ3aLTHuONPbOEfEr5V7zbWHPTjOQoOI/aizekMaC9yapcKw1\ndTmjccRu3lRQzXxTjAcOoih+x6/92TbF6GJhml02bECrAdCuju6K9evt2DuU\nKc40c2tLG/OAyWBmt2WtMzUoV9PDZIGh5jyAmmzi8m27FG8DY8SY/1hgnVCc\n+6QmOxBHdiflnaVf5rj6VfNejyGVjZo3zE0vQDC2P1UBgZUWUhFQ0rmPIV88\noYyon1/8DhKOIRVw11D/3N5nLlOlihXVluZAG5tpV0vWm2S7Kd5JKXB4cBK2\nzcdXRntp7B9tOu+Nc6/eNpEYYdnUnQ6jRuDDLSsC7y9Rq+SMKQkphvkTNyey\n+dXy\r\n=OzKD\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1547960730125_1547960740476_0.7201008312906709"},"_hasShrinkwrap":false},"1.11.0-next.1548181462679":{"name":"puppeteer","version":"1.11.0-next.1548181462679","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"623082"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"9fb89e1bbc143f5e34f5ff25dae92077bc198fce","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1548181462679","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-+U1B7euCzDcJMtv8+GobVhF9KLQ+C54iSMBFsTdNm0GSKElbxv/pJWE4oAn1c570phZjxtnLFgYzGNqTZObexQ==","shasum":"f27a204adf11c0f6aeb92d8136643ef1449cdb1f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1548181462679.tgz","fileCount":65,"unpackedSize":701005,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcR1/hCRA9TVsSAnZWagAABhwP/2E7/BDhdnyuWPVW6w5W\nxUYRB7zZa0+ar2vUFN2BCGcQpSKSyuwiUPKdeWR6U0EWQtkzmnyKbaiqVS6M\nb5jGjA5VLub9Rv2HRte3PPerPpmfyL4nCi3PLjWCQHXD6J4APJ/jCuE8EWLq\nCAVlgDwZyiVZTL0r4t15px9oR4B+oaZmDOFjtrZS5LE2Y0Y5z23Y9N6m/fAp\nXTDz6VckfquabE0qaPKJKAIslkAlywXgzUgwvsXlL1viYF08HpyBm5JeUP17\nErTVLHOIbK5mBc6GxeBQzZWBdFAehI+SDGiCUjCXr+y3+8KTCrdhg/QBw2/a\nJu6WkecXo2tkVo1Rvtx9p2g47agpfXHvKkzRPENV+l3JWYZzZ2HewvaMofLu\nt/BBVXtgNpFZYwfapkARtl1zAXMw1pyF9/lgmMj8l+/o7sirDLbIuRS4Yw5Q\n0deDyI6hhV03hr4eRAL45lMVwKLfw5cCfDrBzmQme7jAocPaWYbFwHlBaG5N\nJh/4h9zPMo7shlmhcW9H2S1oh4Fy/XAWEhV+TYDjxR75ZCuG35FwitTXNEeB\nvEBdle8qppeB+3fOp2V3zJDfFdGocIdz58Ta7SNZ7hstIusjrujKmz+ewsRH\nU/YlqaiKTYGShPXC/4zRNuOiLm/CGdpZ+hLezwwWhB9fV8ATtrmlN6pkiux6\nnwz4\r\n=Lv1R\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1548181462679_1548181473220_0.9090696237556573"},"_hasShrinkwrap":false},"1.11.0-next.1548183570779":{"name":"puppeteer","version":"1.11.0-next.1548183570779","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"c09835fd70e144cb705eb5ae8b169e49725532bd","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1548183570779","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-/wMOkzGhEygw3M5hMqJ69AQMZlG5BKIrmG8isvSduVe+mxu/xxUirXaTLHPNhasMsfX4fiCY7v95cIfpiR9z+Q==","shasum":"34769ef1e6f6495866a08448c71c0b4a6c6ff4cb","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1548183570779.tgz","fileCount":65,"unpackedSize":701005,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcR2gdCRA9TVsSAnZWagAABXcP/0fAm5hlueFQW8eYzWuj\nzTA/N6QcnzAQGmlIJrmoU74iK8mLX/TQNvq51coX4SbOGNJopLt817LHZ0Vn\nxawSqDvLfLkP72Tmow6wSgZYNpbHjl4sZjgn4pGpdXlnhhoMsySJ8KLFfVVi\nxDKfyz1h1gXxdzG048t4LhK5VcNTXXK56+BAHYOjD9wRuyDyHBurfWAwjATv\ngeqey/qoAxkgKosVBSb76p6uyeYviYxKnui7NGvb87HnwZAP0NYv7uCgtDQi\n1+Bwibimm6fsRv/PYTgqBv0rcfCPG+cWerI9SNySjP/WPm96EhJnJUizLVSo\nzfHqQIkO0aRaV5pxqmVg0UNZKMSTxpaJ2WIIA3Vt/jEHCycHv2YDfdJ0E4h4\nWQpY6ryOkN25TjY5J2Q3rkP2wPwFlOd+dSVDUP29o9z5PmixGC/gbZICLAE5\nyv/QGoKaNoiEStoWMViLi/qaQxoX0jlqNg2TVRgnmavERbALCKIcbf9hnn1v\nASrfD1WdpH85AcuiZ1BSk2yrG1yOTsxQRYYyYoAC9wLVEGnVpAjtYHZ7eK0K\nesA1NysHiaUceM+ztzgaN48FKGQrwBQfFmi8stDqQ3e6ZXNEYJUZW4HBRVWA\nmssGLnPoFyLY9FiivyPUudx20GmaAaWaDzyRexrPcwtZVUGx8KhNlGC0FRY3\nidP4\r\n=sCtK\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1548183570779_1548183581097_0.06320085938431119"},"_hasShrinkwrap":false},"1.11.0-next.1548197935129":{"name":"puppeteer","version":"1.11.0-next.1548197935129","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"678b8e85ad3c5ff87fb4d331d1d1d198809f793b","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1548197935129","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-aLtt8Rg8Ouuh4PDGAF7PoQ04we7zM+Ptp6//z+WP6eViFEsF2vpvG0dqelDP5K+Z+ak0uBz62jaRvhLEVRjkpQ==","shasum":"69e655f0d952ccd4eaa370da43ae942b2492719d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1548197935129.tgz","fileCount":65,"unpackedSize":703473,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcR6A6CRA9TVsSAnZWagAAmTkP/2Iv2tmkyQoVNJpKW47D\neVAu66/max2M0sDXUrqluaQNToVKAzZuDfp3jb98CKSyHRDQgfQ/DErIWpp0\nTjXX8dRIXThat8D8Y8wkqTb9zsQXyfEOsYQC1IFlodk4/pl4qAoYGQ3TjEcj\noTJjNIv7LXbfshrRYiTol/8KyQwyAC2ipEFasqBhGjHPj8L1tUMeQkA0wPqT\n6OPNdvYQQ0bSAYy8yf3onnZGBiR2cpBhPpJzjKO4pgOAeOuOyHpUGdCJnDJf\n/M2bJJJLzePGtWnc5iyF990md5KbDy2qWGTHQ96VzSKdOVUPEe9u0029uH1R\nk8VMCw2MvBT3pulm38vkXNFi5p7IMCXCU9/V+9T4b4I2sBJeete2kU+CRy0q\neQBIZ8K0aV143zcMI7aD3vVjTuYRK2TFc6syrZW0lLBYHlEAMo7hvlxMiNdy\nCfvFIkrVbLmxHP088htCMIABJlqMtxSNfzMdJcCS3FhSyu74SK1C5cfsxAx0\nEhk8ksVuRXy2Y8znkFHeGex9FRXYpI008b9vTm0nNMB6NuCefJdfItNqEIwP\ng77TQn4xx16DAKQdkY6faIJUINcruGh2CO5mED14IjEhaNVaIlqGoPCRgWjN\ndc5gfRGLLG6o+VhJ+pmXmjDiz+k2Ixlv9LgDg/u2tBtWogYExf0U3Mj3oehz\ne5VS\r\n=0Fja\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1548197935129_1548197945519_0.7871478529000835"},"_hasShrinkwrap":false},"1.11.0-next.1548198789601":{"name":"puppeteer","version":"1.11.0-next.1548198789601","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"89a5c396bf71fdf6d2dccc935190e353d6eb671f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1548198789601","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-8kybBE/VWUft0ePllIi2debBxkpskCsVr9ylCkKLqJl+67pHW+Y9QFaQhgGyJVCcnRUV16ELYHrx5I3MFaKA+g==","shasum":"4b6ce2854a0b7f10e4759cd7b6810497ace9e428","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1548198789601.tgz","fileCount":65,"unpackedSize":701247,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcR6OPCRA9TVsSAnZWagAAzaQP/2dIh2yPHX9Usrwpfrh8\n9lwRaife+TpZkCAl2lXiINXfweUwxG4AWRqCwHG1bv1Q6wmYyfocTrHsZbUF\nGSHNOpLfgxbjrGdsmJgARlQhZg+m0D5Zh8N3xcmudHmTpY7NnLR3cw58ryEq\n3a1+zCONzGiNZhVp9AA3uNFhKxNPq/U4de/c6hCNxeHOh5dahLIYxWGhBrCE\nJkGtD8/GOXkcC47xsLXo4RTModd2Cb3U7jgxBMzX+r2HVQWVsHAmz4s5r955\nI2OvnG+Gni0ka4+OC40ZHUH0Da9YraZvhuXU48b+3KykewUb8rQPPCUZs3qj\nKF1MZ1yapH39p0zEtQ6Rxp5iqBhMLCSvmjsB7zYdVm4hoPDF0PyQV4oGRVW1\nqT0SyhQYDLRO5xG6UaSc52Zx4qzfBLJ/LFkrhxUKPQiyRdcitfumbe0HHlFW\nPpcfaWViJ3VYf1RpxDcN0ktoNDmgSYrjiKjPfVSohi2+CYVL8XwoSiVviOr3\nsujO0cCR5bniseoIQX84DvfSdl2nofjOIfh7qd2hoHPZwqNGNe7Jce0Sl80a\n242uRGGbixe3jc4rvHO2lZPpKtO/SExJ2erKWmzjnuNywgyBy8IrY6q8lmUX\nRjQIPeWLpvLNzX+JPcav80s8869LYreQSWNagtMnRMFu6vrNbxodpVrayNzS\ny5tv\r\n=Aa4r\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1548198789601_1548198799264_0.35463883637549154"},"_hasShrinkwrap":false},"1.11.0-next.1548217700084":{"name":"puppeteer","version":"1.11.0-next.1548217700084","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"7585e6db9ebf134a89e17582a1a495df86fe2952","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1548217700084","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-SMPu5Ad8PVoexMNbHB61ofw7ebipSAqqR8KhYI85JSNeBHTYLimXFyDUkNUpXBCTNz3N39sjA0CuftnsV0e3Xg==","shasum":"266b3bb3cd06221225608ee31854e11774ee2f0f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1548217700084.tgz","fileCount":65,"unpackedSize":701317,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcR+1vCRA9TVsSAnZWagAAB/gP/0/hY5fi6FsZfb4cPsI+\n+aQM9qbJYdhoW5JdsKt04uhG7SbE5SpkQtuxzZZnmxi9jA2ETWRFinm4QiaM\nOGZN9Cd4hBFr5x/sc+8UqrM+wcxhigZaQv1vX5jkTn0yCTiXOOTOTQZpyR+g\ncEnIonR3S8m04K1q1M4yEUrLOl7Yx1wLGoD7wUgE2NOEGBKRG89V/x5Ms0mG\nXjVLVM5pzL0hrTl/wnUxi2mhfdFLw2n+6ZyFmHRFnXKpCtF+n9am8kX2QGTM\n/RCNQ18f7SIwfTnOMzrndagEvdfDuZM2E4Vbs/vJOl01FG+dgTZYqcXlVhuz\nPIwvxjl3L84jFJQBkRvP1uCPoT5NTW7iAhYG+lqsG92yqND4SINlImDKtZQH\ng6xAb+FNcr3SFwQqAiXQJy85K2jc3an5Tp4OrEPRHidzgz/pSMK6EuF4FJaE\nVfu13sfl1ZG+Ohf0uCVLTpSP7j2wEu4i1ky1D1FFmb7a8LhHyIm9x6qtUrvN\nDycravpNX0/z64421ALcIYN87eElJvw/T8evUbouGUroOOP7RZhq6DfZnhbd\nwUG1Y/WgARA9iLS5v0/GeRP4FDBrBPfQMhFo+CK9Z3/L+1DU1PCuiTRU1OpS\n7oYYdGaGszgJlxqtGH1wrtSewh9CeDRfID8BA8qRoT7jsxZR2ePSiD6I/cXo\nVdEA\r\n=K4dl\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1548217700084_1548217710795_0.005156366848972249"},"_hasShrinkwrap":false},"1.11.0-next.1548310151247":{"name":"puppeteer","version":"1.11.0-next.1548310151247","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"1a7995558f101a10cd847dd070b2719a8ea7f27c","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1548310151247","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-m/jtYJCqLAenI6lZA1CLHUDS+6oB+7L1E6ZS6uQyGplc/v2JP6mzux8RTpBtRsYzCruu9JPNH71uGvNYE2nQ7Q==","shasum":"288eb91ea873bc283c7012b3a1705a1b1fa79fec","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1548310151247.tgz","fileCount":65,"unpackedSize":701317,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcSVaSCRA9TVsSAnZWagAAHXEP/RK3bjqxNC8fYh8nAvqd\nO38ImuyBRkjBCB7pZFhxxaMN2CsjsrxpLWAQj1Fk1ALbYtUzYsvBCZ1lO2v1\npBcsApTrb9Apfnrex7+I5nlCxIAH0j2Kt8KhsgZzp6I4aoXLlYC81geVteUG\nMzA4WkH8pwbzRKgXyq4LZVjTg667gIVjfrWzVOe7+x/m8S1V4lK9dREZDi1G\n9k9jQsfp2zDq9hCDo+KFB3nnvyuJilpbE2yv3xZOLz+quzBVg1UzGIQCEwTq\n3q+RSnhHkgCLGMKEi3wn3dyl7ska3zeZ6WUNw60MVdeirP37T2Jft8cJVgc2\n9RlNUDNDmkb+ZbGjd24vWU1yLpQT3qG6b3Xo5eH9HQl+lXMMSxb86mrrmTRf\nhXbzfSP2/XzpqJ24EHKwz2HfyC/HGtAWivQ2utOqkSBt9M86JOOIbQaHYKxt\nwLXpGRBGvAuc6vFOEUzFpeDCih/cGf5MLKNbCQtflg5iaNQ4hZ/GQalS/ff1\nKmJwe9sm8vFn0b3AOCy9ShHiIoO5nE6ENyziF1tr09tgL3Uq0RHrAhfn0uUc\nnHN/AO9DOu7MoPNoLhRNERCFXv4g09KGELgrsA34VNEFS2qgi+rHpKswqnAL\nlU6F/gq6/7KerBgn8dqzN56YnCNM4z4l9FFEB0pTAymHmeS2/k4dNQOWnM5T\nXa02\r\n=nzVB\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1548310151247_1548310162082_0.23956096658464276"},"_hasShrinkwrap":false},"1.11.0-next.1548448163376":{"name":"puppeteer","version":"1.11.0-next.1548448163376","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"cd678fb5916246f586b9345db7d8a3dfa6cd6236","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1548448163376","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-w2WxuhU2/+wVErEAVGamNdIagG/V95mr6Vv0T2+EyXGZtyYeeaWFaOLyHO/Ly0v2bBm0TvyfhAZMqk64DBvd0Q==","shasum":"8b66d88a5507f69fdf7be1176eda80831e037653","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1548448163376.tgz","fileCount":65,"unpackedSize":701317,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcS3GuCRA9TVsSAnZWagAATDsQAIo3g3K8Fxl23k5/gp8w\nK9pjSJjo+x/BuSU7bSiZrxQOaykISxUsD37RvZiKy0XqPi2VlPTGqrtoQ9Rh\nhLcqNlE6CXPNrun+VI7lMyABGb7XAjU9EbAn5OF+NMBHq9jfDFtT4kTDiR+u\nv+E+k2LQR+f06vUh9lyg35SyPMEgQ5Kwkze0HDMeDlTAX0fWUvOZZfYZ8k3o\nFRghbJRL8ZU1p+QwJ6Rskrx+AqIm5QrHazehTyJ2dk50UuroaG22+AY0KGwn\n3WW13Gp5CVq7us9t+m2HSriL0R5eAjYbpSUCiFAvBxywOaHxVCsqzU2DhD7B\nJTVoPdyD1O9SOLxI/byNcjPlrFVcYLsxIoMLd2E/HQ1d9i36dadFS2GQrXMB\nYxwRIQkd67q9magIGw6Dpyaw/++S6XYAdFZ6l6tfu9f1a5IH8C3XSJCr4fs7\nIxv1NXbmuAijSE3fiE+SczBnxpEiGHDLz94tFpajRNx8xyB+xy+WMpJIyAwL\nn+t/uLFRxMkKScdtWcaXO4pVdWL1TgdwsCEePyQx8EmmaVDJ99H0teqH8/ui\nuOBGzAEqKpiPGNo4c343rbgGhrcOJL2/7l+5k7FeoqhinDsJ2qWqgAfb/Ldy\nE15T6JbU+u871AEhefBuNdz0S13tLhcn43X6FnVhj35U/mU15yoy3wmhMZf6\nqWOs\r\n=9upV\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1548448163376_1548448173770_0.5327220616895698"},"_hasShrinkwrap":false},"1.11.0-next.1548476659504":{"name":"puppeteer","version":"1.11.0-next.1548476659504","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"62da2366c65b335751896afbb0206f23c61436f1","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1548476659504","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-d7OGRRgeoN+xT7KF0ewq2lDYy5/hPHWZ/QC3mWjZFexmDBWDdTm+ooZE7se8SDpt9OpIIDoSyDnV7CfaS0KfKg==","shasum":"c10392c869529ece7d5a2c8a710c2142a19be52c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1548476659504.tgz","fileCount":67,"unpackedSize":701508,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcS+D/CRA9TVsSAnZWagAAFtsP/1K3dqyQ8fR1PMxPOAYX\nKQYtbpG2NYiz95H1m73boNlA+b6X7qxoZgIkCsnsdBdo6Y+GouKNTYq6tzvo\nrlBbvVyUwO8GxhoAym1Qud3FKZIaVEiimek+HMaQAKoGDf9H17ZdXxVdICW/\nc1fvlQwWzvMn0H3KAHr6Ayv4o9AJewXZLS9lbwig2/f3d8d/QtAovCz+pH+7\n4INLAQkKMU7up4SFnRvIDKotNx9U3HgNKZCMqc3SkpwKiF0tqEYQ7E7VPqC0\nyZNeHFn3Zo6qFDWlOWkfd7cT1XnqTnpcDh7o8+OEhDhtskpzmKEreQs+T5iS\nkq2uccMM0hMfUvcgikpL3vn/DIOfwA0/H6AvKjrl6b54RS/JgRMry0+HxaqB\nJcCPhLKVfRmcTdLfSorGln9JyPZFCtjy6jmXXnhHtiy37SF4O2p1sPMvqIpG\n4I0pUY2KlSORjrt7QuEnJ8ZIW9kY0GJJafKRyuM73XMgKXjpmJ5shM+i5wLF\nZaEb50fuVhAy9rwYZRzu466vnzPw6NxqIyYaJQW4e0geXDqkmqoET+AiuZ97\n9hvyRR6Vmmyr/vodO91zenWGI1HmdkNyVD/HTB+K5KbtAtVWPXpv/SX85lDR\n2GE7zTaFZybCr2gbq2Czw0c6ndR7SSXqrfZ+215FjDmhcy8a2wB8QOjbXFgi\nJvOt\r\n=HNri\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1548476659504_1548476670502_0.9156713755806829"},"_hasShrinkwrap":false},"1.11.0-next.1548567610624":{"name":"puppeteer","version":"1.11.0-next.1548567610624","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"7446550fdbbe222f69dab35bc0317dc9002d46ad","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1548567610624","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-lkdLGnEjrZYPgiub4LBSwY1rUnARmTKZ+CBHWYEx7ncwGzu08pshyYdEt+i3GQ5EYrZtTRN01OW8L0HcdMP/QQ==","shasum":"f30be7901e3470f68b3c3656fd5ee6481b5fec24","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1548567610624.tgz","fileCount":67,"unpackedSize":701508,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcTURFCRA9TVsSAnZWagAANzgQAJn6xczoOaXvyIjo6IUF\nYZxq1uG1SYLsp3MZgCrSvQunte4PH+JqQWp1pE41Csa+um0MSgGz7muoiewg\nY7qPf8VoWNg9wTWxKX/6BoH0XahtGiILJJqFX7OsY4pgGUKpeiY7biHR573H\ns4q31IuEr7ZTvGpxZrH1vH0UhGFIjzYaAlOa9WqaaoLXqVY00aewmq7oxST4\nmZiKz1gQAXyyIiOXn1jDvUs9DqizQyHXykM2AZJ/IA2skwHWZvie3oDsacTY\nrHFm42zm+GWEeXm8+Y6eM8lD38utIslbNbWbwSLYyaP1Zo5kZRmYwczTMMGk\nvHsTgZHZZ0FIO5A4La/0jZz/p8MeaFyk+L+HRM/gDbB+ZvLvO9x2Jj6KE/xw\n9HcPvr1Ock+6v6GfRZZonce/pHha+JdSGg0NQi9Cx8ja4ZB4tmPwztR/OLmA\n3GKsawkb2kbk/O+nQ2mH1OH3umKIFncNnnaXlW7LJtEiJIbYDpfqT8eKL+b6\ng8eIr4wuQo8F6XhWguhfZs158EwSH5RL7oYQ6KsR8vWQ+L/GPioa7le2/CFs\nnRMCk5c8reX/ljV5RNRTphURYx4zML/GnuG9qtorTK6Z227MCsAGrYA8MPSf\nQC5fL6xaiYozX+/+QeUDieuYbxDcWKUSvr+6nxPavmarHwLjMahDrpYsECqB\nlFj0\r\n=PMBs\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1548567610624_1548567621345_0.6499088440464651"},"_hasShrinkwrap":false},"1.11.0-next.1548703685570":{"name":"puppeteer","version":"1.11.0-next.1548703685570","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"2061dd47181b024ee90e37349736f154652bc74b","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1548703685570","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-Sut82SfEVOERxZyy/cQfLNpIjpTQxvmPSeVebeeDQmsKfsZ8S33zmZZWriD5HsxbDCrSPzGQJFqzTIFNgnFTQg==","shasum":"cedfa1135ad9de5bea80d82d190a8d40b130135e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1548703685570.tgz","fileCount":67,"unpackedSize":702450,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcT1fQCRA9TVsSAnZWagAAGcYQAI66tTJbaMAyLFRQ1QyD\nOZvR4UqiwiHu7aVmrfKOSQCZ8oPy/OGUZLJfbKCOTDtgFcMfL20ACfKqgBOD\ntDm9HE7lv7nbmGmQpp3HVvglxPYBvp4V0M5L8umMrVk6xdc55KMCZcnPhBwG\nuDCeBf2r5EGSg5AQodIv4xhi9AT1rll4SrhMaHYWiZDe8+TVB3Wbdfm0v14W\nKenZYtI0eHO4Xe7fG5iUxeuriDLAMO0rb5kAk6JOtOrnlONjajey+75Tiile\n8yssE99qIJEiWWsXKPjHaUbAcb9WbGdU61ctQ6UE7gUHWDUWlvEbXGGqShSq\nDHKurAymfk/wTCIYvbIPjlv/RSESsqy08Ee6chHOucltNbz5Dem1F2IzPZZo\nxPkIvEeTYOarvFWra1yYJuqFQBNTUOyqixSeXX/s0a87Ycl7hlJMeKtUqJRE\nYkQFcUSzXGOP4jBVupJvoYV5NQKlDFMvSlUse99g2TKkpjud0JdHaOXaXf55\nKAgCo/KHzC8zjqe016lz7RVfFYmLtu6ngyOKFMIPsxa0iL5YxCyf8MO4Es7o\nsusQgipWLE0lBtVXJ/4lDbzQ6uGOrD+QVd4U2GrND1rcExB0P1l3V3TBww5e\nszQ7sK7VmYqHGLrED47SREmtrSLIEa1h4JzbJZPjdHk8733s5q/OY1XFFAGe\nYJz/\r\n=49IH\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1548703685570_1548703695992_0.6940789958050388"},"_hasShrinkwrap":false},"1.11.0-next.1548707281525":{"name":"puppeteer","version":"1.11.0-next.1548707281525","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"55432f88e99598c41b8cd73f6aa9c27faee51873","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1548707281525","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-aNxU6DemBnMYoiYEdCHIZoqNH+igh9sbtnfklK47Lbhq+IfweACzrFpgR+1TYD0tmh4av0Y5DlW0xRN1ilX/rA==","shasum":"f30917aca87b882c82cc56a70daea34c0e361812","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1548707281525.tgz","fileCount":67,"unpackedSize":706678,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcT2XcCRA9TVsSAnZWagAAKxwQAJJnkkpQcCxLFjaEg2q6\n3uNbg+J8OaIFJD64BRNc61PsswT0yu2gb8LIQTcFKfDVMewHBc7GJ8YjTFLt\nUFm2KigcxWQReLQ5q88aMCcNtE1zt2Xm+/y5qUdhkwAlY3l7KUBETonGkVUS\nb1xe7Ssif2jZShGdoXAPpjK/2uZ2//p52UC5yoxGH0tCBMpcg1NZ7hI1uxi8\nOe9HdtcZBJDCQF9TczcXiOVdHhse4AaVUE/Xu22HwmpXUiYj0TtDyomhLO1Q\nXlSIuvPKhgQi8FRqtt808mzQn+m6OlJtUu1PmQ8eBs0EbpWOZrXwxhritSUz\nHUQpbsdFaA6vrQQt8/snXhmrgsr/CHQJX0EhoJ/In0vwsNfrqsB1162LfJSJ\nLMCFVx/vlO/X6OGAHbv/++jwN9fY18NtO/zK9RgFU/DNc1TUjt85+aki+lj5\nBW1VNxn9I3IhBhfG1sfJ7JiewruFUmUH1MS1U45jCJxrhdDl8yZIL9vLvsUX\nSU5qhmtDkuq15HEliDFkBODocGzmpOSa/k1tWKahyyWuWqFVYxDArcy4QWHT\nhog7jsuE4kLECim0mieOvStAPC3tyQz1wLEVfrsaMtVdy4wMZOOn0vZuPqJy\nvHlZ+AovO+1QfnjYngciUos0+cVzfY5TcoQYdIOUjNIDyTXqKGgcL+NxrCQi\niV5U\r\n=jdy7\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1548707281525_1548707291669_0.9968603178232438"},"_hasShrinkwrap":false},"1.11.0-next.1548714258861":{"name":"puppeteer","version":"1.11.0-next.1548714258861","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"63d9ac4df81d4e44edb1b1f15dcd4053329642c3","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1548714258861","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-qv4UW/lbI/vRj9dYnjwTEYpBOwZrFNuiZtUwyeX8+NzArCXe5snb4/hDVtUszELy2J65N79TNFqhM3iJiDh1MQ==","shasum":"4831e0876b8c970d6cef8852cc6e589dab78b5a5","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1548714258861.tgz","fileCount":67,"unpackedSize":706764,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcT4EdCRA9TVsSAnZWagAApBYP/0a/th7HEZ7d2GhUyTgl\neOitzJYieNTZi915lMh/ETLaPaDmG24su7Wfwt7o9VKwnforH1h371n+s2BA\nmnMQg4ecwhHC6X2bCUvzk5ogfc5QuP+HC2kT5IbdmIIxguBdEmsvRbxaKeKC\n8mKe0LprZ/1U4h5Xxin6zYejL93dCPo+yRnMhpT4lS2s8MO9ywsK2BIQRx++\n1bx5ufmEeBaILV8SbtnKmlGsYCIEqLuS1LQV/mjaB+sIWiMCEz2BMCRh0pIS\npvM81glkO999GgTSk9H6YU9T4n8E4sg95+A1CDeP8WxgkDJqjS9i7b0Sx22y\nDhZJWSyqMtzc46s+1di3JnzVc2kuLJ/kCIVhsZ6ZWkReapVtiR3wAi6A+CA6\nhA37T6xQf0TdftQkSwgXCfInh1+K2kPY4FoMxl9bb+zRh4JbaUjlZmyFwiMY\ntxxi1kU64Jtw9ityQwZ+IG8HPxhvRcN9ATX+g4Zx2tw5szX/AXXL0LFtzVsp\nDhQ7/MGc5eNfJx1KEbPFVQrn0alwuviQbDqpcHC7s7ivDTYnlqvnbbhffpUX\nwh/br0mOraR5XeBPpYbAw5uO3OJNDozLGirOQLn2DuegQYT2VbOXxCi3mbPe\n2jlQk1aGJxhFa6WroxhsMV/JQWwVXyWGqujEMj5atjk2ORFeAB+TI/yG2TAz\nw1Z6\r\n=E8zX\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1548714258861_1548714269218_0.4407616602703337"},"_hasShrinkwrap":false},"1.11.0-next.1548717377583":{"name":"puppeteer","version":"1.11.0-next.1548717377583","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"f2c968fdb808970a742a2228ad2f65fe708322b0","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1548717377583","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-WizULq02gjZ1Y6nbPZ54oaj/sog4mrNp0yAeZyJrINT8aMOBszGGZlMX3T0fw+dg/YAdmMAdjfMRkg6PGZ2BaQ==","shasum":"873cfc1d1ba6c7b29cdfa82f09abca5909b46144","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1548717377583.tgz","fileCount":68,"unpackedSize":867812,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcT41NCRA9TVsSAnZWagAA7lgP/1/MeHMJZgEe41rLtcWz\nuf9n0tB/0WAMH2WZVjh04PiwDBQ2HYcEEa6gY/ZvhEgKX0HySddk3Jie/eZH\nuq+HI6UlTGX2RFmlY6pyGwPiKdeLMVyF9HiROBN1V2p3JQeTSev+GmgPWzoc\nNj0ouh1sA86xfJXB6RQtuVHhTKBvz5HC7xc8lLcpNEYsBwyMUEI898hsv4m0\n0ahXZfqGdb5OvC2XClM89OIlPFxbUxjc4GcoUnUk9ZBb4rdqwIRERcF7cFFm\noaUrJ6colxnzD4xdTN/4TEIuNFWFjc7oqBxVEANkhiEAUEmw0jjh0qg++9Y3\nPDivWfYBUZ82sxF+X/Malu+D6Kc6gxKIJuE/aUhiRFW0OxDB86rHtAwa9CpA\nBTAu5WAHmp6zjbfvu15m5KzUyTIPUMSQdgR1+9LXmAlCuVfSLpHEUaPt1+Gx\nTHxRrlppsyd4Bt1fXEKklfeQyhWpHwmFL9vJ5mm7Xv2ybsiiMEI7dVShVxv3\n4ZbmC696WavFZZmF73vXqtQyjXLuiFzBwTWx+qB1wNZeYa4ZW6z9TZQNgPMI\nPzruAgQ+jd26INmN5HrJcpO//QYH7DwGS/SZ7B03S16xvbPbXhgB4nIz+rvZ\nFEvOWKBM2RIfMIVv6+y6jHBcOuHv2ExczEVAaBJBoo2bK7Ort1oWKhiq6jzV\nhMd3\r\n=YGi0\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1548717377583_1548717388701_0.31198609299947355"},"_hasShrinkwrap":false},"1.11.0-next.1548724983083":{"name":"puppeteer","version":"1.11.0-next.1548724983083","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"7001042f796426163f13ca9716408578f1118bf3","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1548724983083","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-XWvGMDtJ47Mr3SbDVCFr0BRl2QfLSQrOi1embm1rgWpcP15kX5xuW4hUDUCbOMAbfQxRMByg750RcFQKcmlT6Q==","shasum":"d8a1124cec2fb911e49a4902f1eb2965bd86ad24","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1548724983083.tgz","fileCount":70,"unpackedSize":873961,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcT6sDCRA9TVsSAnZWagAAi1sP/RtJqcrq8HxxH7oq4nGZ\n2v3uEXqq2LLnZBWYDVodHzUN4xp55bm++YlGgA9cklopEfENZ6O6p4lCYdrx\n/AGYVnCxJa0xjxUdOtZ33grttnYW0M1HKVY3rqxND5PqVLRworCzLnpNmTsp\nR6ugQuQZBTpXsHCeEwXOYb4b8b3Qisvd723GEGsHI3mXjTQaxhFZziSmIs4u\nmwqT6X9v8WVdwmQpQbqC7XShluGSC61uT/xyk0F/j7TGh5XRUHvThs83fjms\ngyOUMnUKjIKCx8JD6Z0PD46VsSFSvDd1t8H96gJ4n4FNAfj3yzgVECjlSudh\nmfQRGTYzQ7J7Z+LkWBjydn9oW9OVWbBVbsU3QrM1tohKFTfnIFMrHov2ob44\nvGUO5FiDFVFESL71uNE55hu6R9TvtKVbsiLFlY1LSZxYiN/968Cl+iBPPeUv\n7DgbqxuJWEYSMFVPOC6Tm94YR0BV+088lQBhNYoXHghlacnYsCjjjrWAO838\n5609//I8eKrsMHD8cfj3T+n6eUkhexU0vL0TqAeFNDq7XvTOJ+Ffly95vTQk\nhNyEISXST5uRZenJoV7CR5AINLGv3TmkQDadeTgh8PXNfRivMT/DKcFGMG66\ncZvyHsiiTxOMZFWjZ5GmU0x4Zj03fx/AryEKEEiqKq/PNLi4iD6e89Te0jxe\nwFCX\r\n=Hh/9\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1548724983083_1548724994371_0.7497348107253377"},"_hasShrinkwrap":false},"1.11.0-next.1548894144934":{"name":"puppeteer","version":"1.11.0-next.1548894144934","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"a2f1e2774af31ffa7a786b0e754ec638ab428d76","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1548894144934","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-0xTUtUJQPO3/J7pHa9Xc/1fNCc0DT5vwFg1h9unzkB0uqkYxEXPSUViyzisdjhpYienO7VxsRqPAgDnqorldkw==","shasum":"73363e3767c178d008239a1a0409a197436942d2","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1548894144934.tgz","fileCount":70,"unpackedSize":875321,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcUj/MCRA9TVsSAnZWagAALQAP/0jJWOTJ0XltZl/RaNXh\nlGo/MDJIn0AWIxEx6Kf8hP08e9OeltbE8AVPi8xyv4ywE+MH4r1R1XNobhp3\nlY85xDuEyj6LQnQqpmL0H6X7Gt+jl7veCK4tlZaP0j3VkdHgSOaOS3lelScl\nobdtjmkun+zeZGUhBWjGM6ZvT+tzdMkyPnJNQww6zX+xnc6fSvpyiiZprtcH\nO6AcxEVCNDqmKlnWKz056ll3POxPzeeMhdUQLKn0RkckN5f2U0ckWigKo2Vd\nW1vziDyLZz4Qqg/NwqoC/bJhKThEszZzUWNrsuB/aL2HIkdkGZKjC12rqxyq\nuYiFMzek3IvMqzyBCHL0Zi5K5ag6JxkAOmcvx64OTZNhdcKid9qOMdZUXApr\n1ihdDIaoL6pZraLXUCOPq5PAFkH/B+aWqpjDLkPFbcg5IWcY10lRxVzrBOTs\nXn6MaRho+2Z+vLR1cH76dRUr23SbZAt11AM+TtiysUv9kwI6p6AAMTGoaYMX\nLWIyTfxxhPTU6MFAB93HcCuKvo6RpWoNWmjyWVKAKEPIjf0Qx4D560ddvghu\nXTtNAK8otqJgXmUx6KxGpOuYrBoAlNFpEvelWuHlzah7d6Z2dA4lu/WMGP49\n15Y3lc7y7KZUif4w6lo3xosQLbEtFum1GNIOB7ZkXOc+KeYMXHQq4X/0CUM9\nYY6j\r\n=A9qQ\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1548894144934_1548894156396_0.6332407981019019"},"_hasShrinkwrap":false},"1.11.0-next.1548985003787":{"name":"puppeteer","version":"1.11.0-next.1548985003787","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"3c516f2114fa36b39b1484315a0e9c56478b2cd4","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1548985003787","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-ENSmUsGdOrLtzHBfHrQLF6156BuVn83N7fxZ47rr4Q9rCs+PmOEcOK7L3THQOG25nbNWOGdjNPpL19puGzvvRw==","shasum":"c29674d7eb4ddb36a8571389177ce1846f71faf3","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1548985003787.tgz","fileCount":70,"unpackedSize":875321,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcU6K4CRA9TVsSAnZWagAALZ8P/jf7jnV/Tx3fJZOC2FJR\nYWmAkfDx7LRBUcvQEFYg0+WoYYmjUpjNYrKYplrTkj5BKyHfLLaQ6fDMqpXm\nmSbFaZO8Y0loacGHbo8/K2bE7u34F9YhTSNWuAcjYKSOa5MGh9JRH8I0dtTZ\n6LFeVHWeVjEp2MBkJ9vY3tiCVtDl5lsUF0dycXPku2QLYlOxAKRgvK+D7X+j\nfQMVUngc9AKRxmjr76o/1P+hftLvHpK+QkD2WOxPDvWyJtY+sUoVP9WIBNy4\nzQWtoyBAeDOTv1AXKP4Atex+J1XMvzebP9NZp5Y1ZLXb8LxZFS/VYylxtDfy\nZ7ii7scfQtiOCwDR2sEln5oSITXUO4SpoZGSWwGaI0BYT22zGkRuN3hmrsrZ\n3Ndn/5+sjO6Lk4ZAutBy8Uw0HbpkCI7l+4ZlW2DxaTeGGLiIAIjkRMObu++Y\n1tAVfz8OkFEVaw6ryMnps3QIc0fWXtCDipSHcNN6/Z+DbhvIK7w7No3Fk4KA\nZ/Tmil8d1TzCE3sRpK/CZQlgDHPCTjMl+CyJODtCpHxZzK1L5/U5Cr9ScYEH\nj1hHFOiCKUMoGbhibsys1nDGiPR1y0lSF0VF966ZqgAwL0hTJgfjbwwShb10\njed05URRWlb8CMyJqEhrkeYTdJqIEc2ucEfdZt5yyJgYXRkqzIMrUXt62e9S\n5GqN\r\n=8X9x\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1548985003787_1548985016013_0.577939473343871"},"_hasShrinkwrap":false},"1.11.0-next.1548986177131":{"name":"puppeteer","version":"1.11.0-next.1548986177131","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"5cca7c0cae5bdb2bd83a21b27fa9ab40de8694ba","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.11.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.11.0-next.1548986177131","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-rTYu7DgrMntwoeJGbESJm/WR6RzQHQndo/ei/jqjhYT3jZSXBVF4oa8jVA+cnG1KftCDXGYxKVVW+ezapxpH+g==","shasum":"6605fe77a74fe677691a123de6e6c5aa4ba48206","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.11.0-next.1548986177131.tgz","fileCount":70,"unpackedSize":871085,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcU6dNCRA9TVsSAnZWagAAp0cP/2jHYuQTLikmwtr0OwPR\nqDvpz7btfzQFJOVX/F3VPgwf95bClraT6BQHAGdfrDoltahiY3dXAQ6WnEjC\n2prC2kYiNt+nHXe/mmx/p7EhYxQFYHfcD7ITRSS90uMWoP181n1F3+tUzG+Y\nqYnLSjsAxkU4DIs1NlHkmp3vQxlRES0JeAgEclKzWf9bUwbgoRIF/VIGnIRJ\njOS/+2GJqhozrC5d0N3A6W0q5uAsiMDK5jTYKF+icWY59CoYHUcq+07sKyfS\nvuA/sLn6ID1+BWbJTEvkXI/4xF4EZQA1ymAzztpU9e+tma+efWRPgwWNw/fh\n3VgbV8Om9rp7rtX/n+SZtTXoxELRsy2oy/KMgI417/Sj3O84uc4dN1kDAMH+\nES/htBpC/AILbW8kBjgGn0CIXtsTh6ilX3ejPJzXuPow5F24pbH6OsMCO952\n9mbi5s71bPgQ5DKrfBCGrSY1EXXCe+zodSikvFohq8HQAGCvJrDNKj6JsRdi\nwfBOaZzyA7SA79Nwn3C3jKLkTYfFNV+y5uQMGfnch1VwgNAIPYkgYyDcCeVy\nlhn6Q3Hp+m+v93s6Izv0pAkNOy+PUH2DDJUfH4rWet3AiZZ5YSbH0j6uefv/\nsJIxW8p7ExKoyhxhDT57lHKWEqJU/fLUZfP9IOybTSm+318C4/qJM0W8Q/Xs\n7Nen\r\n=zIam\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.11.0-next.1548986177131_1548986188300_0.10811650728454247"},"_hasShrinkwrap":false},"1.12.0-next.1548992224338":{"name":"puppeteer","version":"1.12.0-next.1548992224338","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"7f05a084f14d4751e9509a2ff97d58ee3b73dd4d","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.0-next.1548992224338","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-eFK2qyYmx/+buzjYbXLZkkM9PDvmUj6i54wcF2lIxAth3j4O/EaUnWGH1Hh24nnzjNsE+rL9xTqxyg3shW05Tw==","shasum":"21e2c6f0376c25b78ac7e5fed1f56b5b210d4e30","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.0-next.1548992224338.tgz","fileCount":70,"unpackedSize":871085,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcU77sCRA9TVsSAnZWagAA23MP/3RtGTAbtWc+OBb9pUSU\n2rTZJ4Fmf3rWOc8QoqpxOrzWcybMihVvzSeXPar7Ws5loYrQxHTUlb94eLzh\nonKcHvFjZiaOJrIaVs3ACiGi4IGud/YC1Th9cuIbCuxZabd/YcZmST2fRrP4\n6mk/GH6Mr8uf18E7r4zu3a+wzDmfZ6E1mmjgq0srPaZSKM7IsRTQ6TucX157\nUwgqSXxdNDjJ3ADHIRS0xsZFvuedOXnJQLgDyG+ukPnCr/F6Pd6UtH8r+8Rf\ng7qBMXDz6hlnXgI2FJufeuucihjL6FnyN/TPa/IyTkbFDB9SPaVQlbwVPOcs\neId4l6eDAiwj3awwq0cHpPL9i01guUlZWPXDx6PjCd0Whk+PWfg/yDQjjTlT\nTUGhHHan3IWVmND2uGFu0PkkP7U5uMYMG7kxNbLJEiTaUpa3ySiv8xjs9egK\nxh9iav8zaPc1BdMNFdqiS+S796GIV3tBKD91Yo70cSATds5Ecg3okD1bBnX3\nuCepU6oGvEY68iwiU/fpM2v9GIgmC+rRSacbUzCQOxSQwlrVgnUqWlLAXTWt\no7Ntm1n8rRiOnohUegDfxPaOISV0yZ+dEprY0H+x0nMdi+uoAwen1dGIsVZu\nhGEHM/O8lKury8+qlhOxEMz/paWZWFLEICw+14rjSNq19BmfgiF0SVVJIHTm\nRXNp\r\n=NQG4\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.0-next.1548992224338_1548992235866_0.08021377189097145"},"_hasShrinkwrap":false},"1.12.0":{"name":"puppeteer","version":"1.12.0","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"7f05a084f14d4751e9509a2ff97d58ee3b73dd4d","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.0","_npmVersion":"6.4.1","_nodeVersion":"8.15.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-+riSxJFPQpwGZvNHFeB7vEefwfdHNSstQmjdzUKZxPp/Qt1Dw9iKRAewl8X0ntdXZz4UR4jODLiM03Iw9HDnyw==","shasum":"325b97f42aa6cd66ae4d3d27839278e1f0b8e0e5","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.0.tgz","fileCount":70,"unpackedSize":871066,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcU7/VCRA9TVsSAnZWagAABvsP/ApBCxUlZZklU3tL5vmr\nQbVnDuQkYGeE7AkYr40qxH+y4EXSlheHtCaRHapgZs4z8WhLTABni0VGOxlY\nwIgw+xV78zHLfoDixfIoiHko0VtIT/WFMwTE+QiiijMaGHYDX5kdaRsMDqus\nXKGjDOJEK2tbRgyYYggIbwGa5rY2q1Bw10T2Jp3hxjhiRFiRspwVHEhf9veK\ngfbS+dY1fHwedThplZAKLGJk7WX2ABydPf4xc2D+Q+Wf0fuFoDr8PN6zwjQ2\nhQR8fdwItlnL6LHUblYzwQyYihK2SU7gKvX986y6QnCAozIAoHUjlWsbhvWS\nUIpv/0gglaPml+OwzfGqvF3EnBO1Oom16kOO1Ecx900J1Q0mhrbdwsG07q68\nO/ebVbsrOx+BdsBaCTl9ZBfPxhO2r6D/YNwZ51F9zUoLukRlwLM9rZ4seXzA\n9H09csTEY2VdQO/ze0My28bHLy9626ADIPcTxtmBmEkpZZDbS+nYbs4j5sJ+\nJvvyClNW5FsiEtvjeTBA6qKl40kvn16rr4kDnFNRFrwICIRLZZ6hhZ5362jn\nvnTnwkKNupxWSyBj20p28wjiPH1xqhUHvjKhNLqLlYwKlYFLi3l9gXHaykH6\nWQVv1d9gH4SRPrE0wydaacpSxhEA9wgPnPRAgsPMrR9pWGqM+1Amgt8HcX2o\nchxJ\r\n=v+o5\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.0_1548992468777_0.8285831743089884"},"_hasShrinkwrap":false},"1.12.0-next.1548993028613":{"name":"puppeteer","version":"1.12.0-next.1548993028613","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"718cdf123ede374ce4b6ac8ab91a813f7bf09fd0","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.0-next.1548993028613","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-DqnHOz76USpDCBMaRjSKmWIX+fPjukVnzEXdE7IxAZdQKtbdVB1hZartGzC4bTqJCP8K0pc7JsBdf/PhyG9jXg==","shasum":"aa21bfde099a5c3c315ea62e83b9b6b3d308de93","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.0-next.1548993028613.tgz","fileCount":70,"unpackedSize":871085,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcU8IQCRA9TVsSAnZWagAAuMEP/Rb9hs2Htu5tJKkdPV/z\n+lp2A5Hnlrxv7fjdSJiBBr/KzqKicWkPp0vIoA82J+Sn7/+7M/tdax6MWEIu\n0NcxX3Ppsl64D62FPoC3+7pMzmUe8VfZ6PbtF1h8tyyd2UqkU4HkdV0fK8B3\nl0yqL7Snci0RfJOCMxT3UF0YZTE+GdhG/Xw5WyN3yFXZVkF06ltC2lYwm6+M\nXcNigpPq8a9f5CfYqUcQ1nOvSp2bCtJdruiNKxgJaMHuXZWvG76HQU3Wbae8\nVrtCc7ephAUl0CZQJQAamzxscGEHJ6xKpGGH7Zhzu2YariaixV5vrT5FEzA9\n0GCZ6cpCtnnWcK3ix5y2tRqnhkIbBkfOPzhx8wEr6lCifmA0c0vcIA8jGKmz\nswoV3v+ndI3gS24Vnmv8srkhwDmrt8EAxlHc2xH1kltgqHswZ+C1hynnTWZ3\nuzuDAi90Gvn6uNqpPXRxFab+VbS4zQ6kxNUmY/t/u60ZiY6aOfAm2jE1Xg3J\nJMIW6YDLzQT3AquMGYJFISy+UkKr2G1D3cb07aEVHcSUoNpCWVdd2I6uKS5z\n4nkn3vV0ojG8HgYpXbnaZBX6+EMr0+Vf1n+nfmdiuH2XfFwGSRc+ef/V+bLl\nz3ocM79W8mNfUJpov4+WqOrUUMMeG8r/KK0Wi7XuY82U2Sw7vm1f4f/8IGTv\nZeiI\r\n=CQUm\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.0-next.1548993028613_1548993040320_0.8012355132049886"},"_hasShrinkwrap":false},"1.12.0-next.1549043939751":{"name":"puppeteer","version":"1.12.0-next.1549043939751","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"23b74650a36ffad9fbf851ed6d574ea26cfb7f61","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.0/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.0-next.1549043939751","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-+oeSRynatveaq6o9ZYUjsEPIvKmMEXJGDOu18W82dZICWEgsm2X2xgwQLDoK7zjq5kexfUG+lZ4uJzRTHXsQzw==","shasum":"0f16d5391f04cc4b2f143d1a0898c1ef9d51e630","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.0-next.1549043939751.tgz","fileCount":69,"unpackedSize":712283,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVIjwCRA9TVsSAnZWagAAv40P/R1E2IRZS1kX2BgOBi4K\nq3h5K9WteY2yHc0Jash4Rf35nxEnFw7Z4nBSB/pIQaG+o1JevfEfkAU2cs5P\nwqUd2IFnrfVrwXftyeB/haNwELhNjvscErlPtZGwMxoy08NxWf4KL3Aofull\n4RCYbihL1U4JSfy/A+/xRqLoiLPO69bbmZIqIGszr4lqdGUKMQ3gFpWGdSf+\nP2gc7OUqmZD6+CFyeCofk6Rx3oof0v903XLrAZQMgNIrD/08E/thsVakwKz2\nkI0yE97p6Bf5rxGfw+epewfSgsFVScgkNxovftRyqaSw8wwlynp/KK607wLs\nEj9qHah6d80ESZKkYv/CF0xaU1MzPVaHh98sYSW3hiEqkB97zPtL6urGXd7r\nY+xr2eshwhmmT3wdLa9K5ufdvUQTqHj5pQkzmcu7RRW+aFT/xoFmGXLHqRvi\naRV7QWuXGIg7CGa8zSu9sBcZbWDGLiZbG+JE1XEMY4BYOpWQur385E/MWuFL\nT7Azr4qUp46pIb5eoyM1mEp/t9ATBWVAb4GO+1x49/zLTjfZvjHMCZr6cxAa\nDU2tW5UP92H05UOVqJoRJvJqXBl9p65cNaxXx/mjGwU589m6LU81FVUN9NZe\n1GRT0MIfxnrBtBfh0BazfJx3pDgka7c3Zyb7pF3eNaHF13VYtbY2PZWi8JGS\n+x7L\r\n=DsBw\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.0-next.1549043939751_1549043951475_0.6336580098707785"},"_hasShrinkwrap":false},"1.12.1-next.1549053217365":{"name":"puppeteer","version":"1.12.1-next.1549053217365","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"a1abd6c1fcea330feaa6e07afdf80c6d6bf3052f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.1-next.1549053217365","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-IaiAsvv0YtosF5koKD3eIhcTrsriCbpgT/zy36e6Ms6YzZUBqiwQOrBAPaS1+bgq+QmeK06OfkPbMiYogHYuSQ==","shasum":"d4e87115a259ce59535a870be6721fde972ec072","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.1-next.1549053217365.tgz","fileCount":69,"unpackedSize":712283,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVK0tCRA9TVsSAnZWagAAZ3kP/iov2oFkkek+78k25W57\nB3WUXPiN8flTR0s8Lepa3tulaHeVn8AKVTMXxQzCkXJvV8u9IV2Q9hRkc68S\n/gSJjwx/YoabNP7JT+li0isPbaTRIci/hu42oPUY69WyXu1p/wTmOePwckW9\n3a0TLiaFI5AsNjvH3vAqdc2pB2guOYdUBDkWUIiFsGzYOZu5LmxpbOGO/4VF\npTG7yNzTn52MryLbReRBRyiIqDurL3WG8GFKz8x9aXjjSnVF9ddyOQl1LsnY\nHwSCBF2Ev/tGkDkP3H2Y5n2sZQb/nZHiRn1be2U7oy38Nmtz4OBkAwi9Qaqu\n43ep6LKYEmr8Q7OraFtCjXV0/RCm+zlkmKG1EWnzWy2HklGznxyzLRLGYUlw\neS50IWdd/Ppum0KZppLMxrPlMrAoZSLP0fniE1/hURaqK/IsQkvWvoIJ1Gh+\n9640UxNS69sFvkirAf0qWX1h2JTBMLPUy2aPfCtjUDVev/ZCuaie9DnXmzfm\nFHiAoq2ralzKrOSEsSZsy3Oxp+bj9pMfJ5T2qM8HetomSz4RmfH6Vf6sSjh3\n2xAkNXhOxKK74+70q9IN4xR6F4Vl6TzmKVgX5TbFVfzWH+3XToO1n9jIK+HK\nC3APKkDWhqaRCTp31H1ir0PPankrZIkG3Pc6KMaB+GpqvAT7NOZupN764A2V\nhwUd\r\n=oJ7N\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.1-next.1549053217365_1549053228432_0.6044158006777263"},"_hasShrinkwrap":false},"1.12.1":{"name":"puppeteer","version":"1.12.1","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"a1abd6c1fcea330feaa6e07afdf80c6d6bf3052f","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.1","_npmVersion":"6.4.1","_nodeVersion":"8.15.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-FlMLdgAnURMMtwb2S6XtkBRw+kh1V+gGt09pCJF9mB1eOnF9+JhtvTxFeu1Rm5X1pKMXq5xrosrhBTgmdwzPeA==","shasum":"440241743f4c909015d0924bdb7f99f670d9c955","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.1.tgz","fileCount":69,"unpackedSize":712264,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVK1GCRA9TVsSAnZWagAAzvAP/2WjchRnzQ1sbHKrRevB\nRkbBjLo15mCZfWCsCF2W2vGfh1NZKpFtNX9TD1C3evE9k+caCn2a0vfkOfqX\n145b8gUpgys1IiS2KR2UbZ48/SBcuzmMKefR4oXQR1G8vqCr2zQ2/fRmCl2A\nTTqTZFvCc1ojs4yBhxCieig+J2ztYrmhLgLWjlbuPnIRrrhuf4zpYeRS/PeI\nTwYPSl7zbptn6qBBcU3LSrUkmMC7aHHrZ62hwYIKsysGFfTkDuQCW3rJhp0R\nDpUhIZWz4Hq0DxuA2iJAVvmznE5ZrjnaKiYmipqKZcpXrZqc7tiQa0MG0SqH\nwF6+sCmB/7Mq1Tb4XaS9B3S86agwWLdTuZO/8RIJFwWJ8XZXM3QU9Zx1CRPQ\neYdznR5WJbn9yXs3dy81dWSrkvIhtM3DNeZZwMRxkzU3f3UBwKo+BUZUSfVJ\njeAvNi+ycLY3HFWQWIGZ+dNa8ignBF8Cf7XftDcUwNk1BD5dFKumF9kRvyH2\nD3DRN+86IIPhPmQnn4X/UaSzvieWWjcM53ET7ETFT4/KN7IYHJl/PrX84KCQ\nY/JmILkNZJJ/PQup0X1EqjBemi99h7NI49oXH5wWazgxh8uE/7ErS+Yvjvta\nOSJ3n9M07vbIpB3Dt9/wL64Bs4nS9kF32pJS3xLHj1RjYe7tORrlky9DwekZ\nLxmA\r\n=BiI4\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.1_1549053253340_0.22179926875348044"},"_hasShrinkwrap":false},"1.12.1-next.1549054273876":{"name":"puppeteer","version":"1.12.1-next.1549054273876","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"b0e80846505ec0360456e7033e924f261106d2e7","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.1-next.1549054273876","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-9BUR5hgAjwbRH7+R+tGpWNgtpGUic4y/ZT1NoXaJdNVK+5DT5hFJs/ezDPesBFTwT1dKB+rmW67admRbAXiHUg==","shasum":"3e9e15eb8ba093a82d8f2417be7602cf65fb20ab","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.1-next.1549054273876.tgz","fileCount":69,"unpackedSize":712283,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVLFOCRA9TVsSAnZWagAArCUQAKHRU2NRO0L5sGh4D4BG\nfrS8DqGKwxxjQvDUfP4nQNHiCfxdXRuXAG8qlTHtOUmec0T0JQOKEWzbRdMw\n0tPGSWzfFXmEtOIPSO3UrvbHUq4gPTV7t3oOg1CT5HUU19yDY+Ze/SC2qCGr\nBJYYxh6ygfsCPdacMoca5bD509YADZybOrzkTcZAU16UD90DXfI+snfpR1MH\nX+iubIVwbT1IqAe+8FbyY+A4EncmiAc8GXSyjcSt5sWa7jTp8A4WTFsWxUME\nfVUbNeu3P71Q+wepdXulvWs6UlXXAZXfsoZDRljto/hy6sJCTpZ1YoBPPT4F\nNH5v5nEk0AWX+h2t3clad3ljc3m5CZIUjAejbvEYrYQ8XSKfOZ/nxmgXrdi/\nT3HSyOnXlDAhDKbuzFCWr04li5SBdCKzwlgwMhl/ob42fSg1hz2vaxFUqyk/\n68kcM+eSICuoFo8edcwyG9jk4mvPAXum9X4GzSMEXtAQGEHxVPgTIXRRu/iL\nNr9mqoZKb8ZgHZmLIbzs3LO8necKF/5pSLl67EOBItCtYcz4diBqgcdik7Ki\nk3Hp78xG6gUHZI4RxuLvwQSb4XbLk/9V5imE+ywFlVq/ABKlhvYV5aPvPPfW\nsYRjjF25AmK5E938SbjE+7rxD9dnjc9LXB7VqnkAvXuzHI2jxrvKZ9X/Xhu7\nfOo3\r\n=wGXT\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.1-next.1549054273876_1549054285338_0.1739164770555668"},"_hasShrinkwrap":false},"1.12.1-next.1549059171178":{"name":"puppeteer","version":"1.12.1-next.1549059171178","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"bd347558bc8bc60f90cf4c9c1e9353ec93fb2ee6","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.1-next.1549059171178","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-IWofGEeGAE3Yvin1NjSrPzRubHLr6PejVk/D09QD6XKb4WZ7vBvJQkwDsDygkBnWSuBBl9OmAUewYU8KG6rmNQ==","shasum":"ed1ba83a66755893b050932a7f85b00e43ec0e98","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.1-next.1549059171178.tgz","fileCount":69,"unpackedSize":712283,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVMRvCRA9TVsSAnZWagAA6bwP/RzgK62SWhPWI7n2cwdG\npa8CgdAtdVlIrFFSY9Ad0h/uATba3crSm742kR3gSiw2pQOPBJSpt3pGY8gy\nZw2jAaKtGHDuaUSFyW2x2SnPlfWnQOzTCKVd6UchcSB+X4E+0tE8Wkwq8FWC\nl7GKIG8Wzgz1+mJfVFhuJhSK7MKDjxtcB+Om71TfWM1XK4qGwHiElJJ3A4xo\nX8YShyjq9LAGGQCu/0cqUT18c6oCXabQnr8DMwb8IL8At/K2VApxES0Skddl\nLUaY2GWCHRM63O4zdd6UzQFe8raXXHYk+J0SPvaToTVlnMKJoslOIcKorST1\nDOLfNXktpyz4xSTjeBf7JeToADH29JaNdJzu8ZNlb3qLYuKHCUxyqRHAwSFu\nAMD+kzF50bGyhpE14wG5fRon9uj5mLbbHxDgr/VN2j1vi2ISDHRFEv2EvM/V\nl42Z47EieTOLJEfnGR2upnDYDpI1GAJvXkMN3oIBNJImH46BZT5XsF8KUP/C\nSTBUGoOisUR4+xUqno9cbtbFpAfKbupI1N9hZP5oKbx6zGKtNXrAx8DtFTfd\neHOseUqIZKeme+TPz6Tik4DzhwL93W4uJhc2szWL2M321uBsiu79X1+LjPy+\n2g21oxh/vi/lOzABhW1yb3iHsHXJmAA7JUJGOgqjKOXWtL4iPN3d+iokb+Cl\nHO7V\r\n=p0L+\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.1-next.1549059171178_1549059182841_0.41511215284647274"},"_hasShrinkwrap":false},"1.12.1-next.1549061801998":{"name":"puppeteer","version":"1.12.1-next.1549061801998","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"fd67fa7a36147ef45b1df7c79812596ba7247f94","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.1-next.1549061801998","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-afNzdHsoHtIEXyoW0HC0Wb1kjcjQuQRb81uto0ZCHchkNUBt4Cye6JZrBShh8NIPsV+gL0K87gwKeH2eWwUFcQ==","shasum":"6f908904044e1b55f9ecb57230d30572057b7c1f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.1-next.1549061801998.tgz","fileCount":69,"unpackedSize":712283,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVM62CRA9TVsSAnZWagAA/kUP/Rl9JJZ8KdtX93tni+H2\nSKh4cs084ejLM9469JNKalz+nIaGGUfoLoD5Ra1ym1ozzWu746DKCvw6e0tr\nCGje0ZChLmsKkMh9I55oZqdK+0dq05m7eNR+E17TUQh36aap6pBVpBqljAYr\nEJdQ61ulyRZVfcwU6fhWwJvzDVyeL8DjQgXfNjcL6dU/AZozsFL+fc/xXVQi\nVCyOTS9lBUmxKaK7MSGOnVBC2rGN2wp8N5GDsZ8GDe8ys0nuTeEB9mVlcnzv\ne79/EdSKQ4HljksbRWEd9PYvBGpvaTo2zIqmyCTEmEt9dHDZdyAoSZrU7T5V\nGB4Bamhvzts+aAX+zhMHmZpKCViQWiSNS69SNqvLqyA32nBHyggDx6GPIvxq\ngW84BvzcA3ngLjUIsPOrs/ysMrjKtKRp4L9gf0ru94fs9HCfg2yhpEhHYZAO\nYXejj8y3u5Sky0OaCHGiebmwMPql8jq5W947dBlzx3BPkiD+G7zUFMvwSOjU\ny9mnT9CMmPO+E0eY8rZRhukue5FpaNX3ViXHbjXlufOb9wqeNmQUtaBr7W0P\naKdUzm7/cWVlooDd3iORaGs4+aRpEEoW+QdhOPKekAG+GpMN+MMjHjeWCILc\nqF0klcG85oKC3QFgKCUezbhojfnbYeSqPLZVFkWEZ3tww+p8PAtxODzQHHfM\nYLn+\r\n=eRhd\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.1-next.1549061801998_1549061813370_0.9530593448894797"},"_hasShrinkwrap":false},"1.12.1-next.1549069657889":{"name":"puppeteer","version":"1.12.1-next.1549069657889","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"84fe6014e99a512a8ccc3718a968fef74754059c","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.1-next.1549069657889","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-YMpmLc4Lw+1RVEAIbRMuLOeN+A+z7CmIf0ltXex/pYcx5W6zUyff7BIRkej7MmhhQj9FqqESign8O1iWOJ6+Gg==","shasum":"f18fbe4df40ee7a6b0f12aa8a55f85b9e2f535d1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.1-next.1549069657889.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVO1mCRA9TVsSAnZWagAA+0QP/3pVeFaYQu+K3NEDaznA\nPN+ubPLkkCKcWhurk1YjmhMoyj8kUVPU9Hha8YRsMRy8jLNfOGQNv7su6l0t\n0YWxkgANNvwZfUfU4nJL9yGZ20s3aH+vNl62XN3860PZkkZ9dGiNlBjF2DZx\n1M3/ut0QNyzgrI9t2eVWXy9OhpiuIpDwi2ueZrQnOCgXLFnrpiof1yPLNC9A\nyMnAggwAGACybYMc2Xhzg4+Ef69gaAXMqBLWqXN6Y08KrJUMwg+NwC8t1x3F\ngY90J8/lY++/g6ckQ0uWi4HctDpZSsD1x+NsBlGKEeTYno7HkhM7WiiZ0P39\nj8OU2VkARFSbASMqpFEOsuayoGnTLsrYad/fXYi0vPLfAmgN1dNJtZBgRY9U\nJdTrAjZsYEmUixVKZ7xMo2HerUNKVA8jEAU4olCANhil8+povWqEUUyQhMxX\nyHbu5M7cZ34EITI57QWVM2SF+MPRxGs+/GfNP30z+ZWf4pxRPVDNk8z273gl\nZG/AZ2qWspCaQyoyYus4zuLVhvfHTWppwrp4UBv9uKXuyjvXnfzTQtH3/nu0\n6kBT94fK7NPy/ysfvN28H6d8OE43eJtygGHSD4bBCcjmZp4uxkKer8EGuQjs\naAwrIm2SiWGD7rF88VC62nKmPHVrHvChFUtxhAD/R6iOXGmK6FU4bMkDSXdM\nBnTm\r\n=5B1L\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.1-next.1549069657889_1549069669669_0.9744306014761681"},"_hasShrinkwrap":false},"1.12.1-next.1549072734702":{"name":"puppeteer","version":"1.12.1-next.1549072734702","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"6bb0350b4dc03b0f84922871e5f85cffc23d35c4","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.1-next.1549072734702","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-HX52KBXIZZcvmqPM2t10WFUIDl8IU3vyYnGyI2eHoKbjO72ov19w7WbQcXth2CaOKig+TA3V8ziVVNIfsSjG4A==","shasum":"79592e4f9fb7b4e91300ff703d680a4c7b82a543","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.1-next.1549072734702.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVPlqCRA9TVsSAnZWagAACOAP/2Slabzee0+f6Q5lbo5K\nubDbtNQvR57CLiCv6u/ethfK2AkK7YT+rHRzwGp/Sjg8trgazfHb4iUjt5SV\nElgrC/w0VeI/I4Doz3JOaMGju7n9NqnfIbAe3+1yxkDNbzgp/qS0gKA/j4IA\nSJcoRYdUII6uxx/AgmOmhOczwU8NKkLKVck1ehcxGxyYy4WzgxSR2FU4LMGs\nUichgH0RxgaacMG7a4eG3J+rQM1I+pBaDnkGl+095GSqWh9pt/Br/WRmq3EC\nTaVyGeJgVZJ5jwUfZponLGVrLvDh/jfotSlySRGvO6vjzjuskskgqlxF1x5O\nazbJ8d5Poc6KDlSGFo6zHlH0aPnyrNU6Rq5j9psyvyLekEz4VEZwNsASusSf\nym3nrjl3pITS5fgV73bl46EzScTQbUqJaxv0XNesVGgsnLjWTLkDbWtiB65c\nfzsKGFZ6N7Jfysvax6q+X/43CYeUxKnZPbsBNOPE7t/q7NyxvAbt50oa9FJV\nVlAKSHXAXzJO2cOv2VaTwvj58jR/oJ4HPltiOWPrLOt1DspHqSCoU6ovdAbR\ndzGvHAFsYaRtNYHlWCkK+Z4gbZZ40hfOerFzXO41UIff8tMyLtD6klJ16bAR\nBZvwPpdHziXUOVOwwtHwwaeuEl3HTB14fh/H0hVb+Spqd95gFtJCXU8iwADM\npoLK\r\n=Hi+o\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.1-next.1549072734702_1549072745996_0.6260611053179701"},"_hasShrinkwrap":false},"1.12.1-next.1549075450014":{"name":"puppeteer","version":"1.12.1-next.1549075450014","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"b5e53fdbf4a8eda1c2b31460f21cc5a0c43fe46e","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.1-next.1549075450014","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-2gwEtRADFuZH/PVOgO0K7BZ6Y8evEYZnJETVkX8Ru6gQRZTR+4jwPDnd5o0VEcanlt/+TRs8Izn3PvPBc7FREg==","shasum":"a1903d34e373282a0080a189eed848dcbac63e6d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.1-next.1549075450014.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVQQGCRA9TVsSAnZWagAAXEUQAJVBkFaZgGrIo2OS2Nbp\nLZrf0MoIH1VR37PDz1Vf6P9tIBoCypO/lrgZNDIEMo+Et7S5X77A9ZKlI153\n7DRyC595X+b1qQ8hyUI4s4W1gL5P5rkXQ0SFea3/+Ke9LJgc9Fr1iY09T/Mq\nuyM47vR0odm2MhiQ3XVIXKFEnTEjra7rTMZaw6kWCkpK/prCEQOCNfmmx51x\nUEBZL+r01JBKnzsZVFO+bZ18Zz8yrvYkxJLrbQ/BrpCYSA1NNYzLNw6BqMuU\nBv3dMb3pXFNdrvxjanhE6jw4lcr2wFvAUyJPzmDPuOw//dhsN2dzHNhnOg13\nV+crkVPnxrQ7961r6GDIHG8pNhs9V9W4lMrw18/FhkR5ozhMZzz3Qik4NALf\nvR7vnk6aOs1GfUeLYiZ7UMbuPkvEHH7Rw8B4Qk0pTH4th5FFdXdQMk8JIEU9\n/BZx/RQ2dHrDIHYaHd9J58wKVnPkwWKXdwisdQAvYn5/4vwELnrATfv503Xk\nuO4879ynA5L87VGYRsQpmRYivPlYztYTgjChXxMGsy6vvhCuBLsoXz9U8yN5\ngGGFBKV7T01GymV47nD9KALHa+KObVjjWg2dpOQJNyFJDS1PVuN2kxbLCcXx\noQfew7BSjyfVkirMeAGRRDRgot5f/5JWVe5k9PvdIYgKT2EwrhQqJ9i/SKdJ\n13AS\r\n=i0iJ\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.1-next.1549075450014_1549075461390_0.4984834634949562"},"_hasShrinkwrap":false},"1.12.1-next.1549137512702":{"name":"puppeteer","version":"1.12.1-next.1549137512702","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"47fbb117f58454947ffc5a8b8e197a2a01601d14","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.1-next.1549137512702","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-y5p+zvnidJ4EWwL6pqbzBvZiyHshTY12FQYoUvFHPZ7aC0w/Tv5V1xWbkTZnw6weEc1L1xG/DCPTSCKfV1087g==","shasum":"9b5f7c88e52c25a188ae1cc2b11f3b3e133ab0ad","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.1-next.1549137512702.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVfZ1CRA9TVsSAnZWagAADCYP/1lSQwt2XQKxBRyvYbBr\nlnXjfjcHcMwIviyAuAel+EmrIrCwUWlCVfDD/yP1akDiV+vGPUKhJk8tb592\nseBxoVIf8A1anUHoO4gSJXNRhPkpet9opFnMt27sr4jRbHFMK+40qox4USSC\nb/o6BmoXVWmqz8BaCnWCjMYWmFkLtS7E7MAceGot4AtLqPCaFhfcM+vruO1n\nnVrvq5q+zEwUVA80JYkU+5t6xmGXujJ9y4NcGu4Am/c6C6QCOiO4SuWfbE41\nfwVvBAJaRI/l/CE1j5KZmsbV2HBr5jZXiZ70O6CSE+D+nDaQa/sbWfqQvj6q\nvZNd/wVqPTaE7a3FTF6gDwQtemHS1D8mXuA1QrWLeYc0GyR2rS/ujAuE8jsS\nrqVz1A3jf3fLlPFfM/9soJZkZMcW2EUk9u8xuojoh1vEskNNd0MzF6/K6Xo6\n+YFtQcIBaj6lTTKUaAV6DAw4Y9hz/mlDNupJPxU4nWqvRgXzzuEpzxo7X6lU\n7oAKSt1qbA+zS9g9nD9Ac1fsDiaszEmLwa+6ygMcDtKIrXzGK7QSNfAPFYj7\n/GXPOku8iBxzQ28mMUDgWL/iNF2kKYsuMXPJ8isM1KIqOyYpzLu/109zzeCz\nYHAZGLSnvVIP0yWGol/M2c8Snp+jrUU5qTRBsxS/pRKJ8O4xrzCXxXsdigVd\n5idq\r\n=Rmxm\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.1-next.1549137512702_1549137524570_0.576640371111286"},"_hasShrinkwrap":false},"1.12.1-next.1549158745578":{"name":"puppeteer","version":"1.12.1-next.1549158745578","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624487"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"69c434af752b8e60f466463918453ff905038d30","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.1-next.1549158745578","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-ZtMYIW8RTy8YIxN/GocMDuJvqymJy0a42yVWWO0cO//6fKNe7VxZkx+YW6Pkorl2aDF7gMJAEsY4gIDDjU1EEA==","shasum":"50c86cbb855347cad47a5a66a51909364869fa73","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.1-next.1549158745578.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcVklmCRA9TVsSAnZWagAAao8P/3X/CUviqRE30ABCFJB4\ndgRNYwCant0mv+CF6qrCOBKKusOR6bpZ1sMpqcgFCP9aqJON1gyqv753+NvC\niHYqMCjb6X5Igomus2tpt4HBy3bJ6qRxvXvpu8Zb47mm9OSTH75cVTYxLeG9\n0O8L3wGoRW2OXvsv+ez+K+AiTXuzNp6rP51SsTzOJMw93SwEzNuKvrUe6O6E\na2S95A6ASF2I3uKfVCfUwyaJ4Wz3bGtNpd7/3mQUEZpTq6lKoil4W9l20K6R\nDqrS7nUNBYUfQ/593GoxPVmocudfKTXr5UumfgUi+Y2nmx5oV+6u/SmCURcD\nxI/7UeHHJtjcGAp5Wv/bHjXAOZuUyaGMC+sJYCN5dky4zLACAzx4w4b0F5bn\n0OAoUDLngLk/PgRm4efZL62DnWSK8bVuAITjKpu3SEk7lOrInonfDNLlCCXG\noslRrbpolK4lSmhUJnNC97te+orKKAZL4BCwbYctQKaDoZQixuYGTmHSKp9/\nF88ZM1407NTuAaf3YyDpI8uBc0XeNZPKPXdnA4NFEvDdz7ynPxAJkKQYW2XK\nmzCexy52yFKlOpWcDrr7eOOaIHzpCennmRPWq46RYDfmSTZRfPyhndqWNssn\nZ+4PaaP4mApLiCXDgBBRdM0kaZr/9PFP5/IbJkGj/EfLlk08zr4jJNLEXYfv\nd9+U\r\n=63ug\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.1-next.1549158745578_1549158757488_0.37724149447923283"},"_hasShrinkwrap":false},"1.12.1-next.1549394930560":{"name":"puppeteer","version":"1.12.1-next.1549394930560","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"6e1f7dc9926e7c6c6a9da594a05d64498d8ff3f5","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.1/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.1-next.1549394930560","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-sSeTV8ggqBjrynzotXDcdnjXS7ymOz5zLdcEg6p7W/fg2vHKMaUMCB/tRNRxSqb/bYbzxlw3qXpACSnE11U0sQ==","shasum":"e57837ced1100bca9ccca4c70c5cdf60bf7f546e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.1-next.1549394930560.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWeP+CRA9TVsSAnZWagAA7hMQAJ7dq1LuWipTMQkK6oBd\ngGFlClu9OP7J+yjJVOBZDX+orTQSv+O5faUiE5M7WJGne9wcAj9vk8Y3INvZ\nbsbKfNgC0BOhlBwsULAeja8ewAfdo153ezkOnWsDumB0eietj/LeJENTpvAY\nnqLyNbSzLk5cDhEndYyZ7QgCAupv13F0hZ803KU+Q0GVl6HvXIGQnLDQv7Qj\nYaaEpTapZjAh5XjpjRayx0dOzVzK7gyTLOWDlLkpa7tPjyTD7VBA3EHt18mQ\nMejVx1rl1TI3MLcRR4/SNtoVoMjtaqPlGmcnm3QGKXLixwi+8qvszq5FfVCZ\n+z+t8UG1iDpscvIm/6bOMB+eJBZMVNdtDGiZlbzk70eAKmNHOMQWfFTGQJIa\nKrN+v22a0CqNuQbOo07zINyUY98tjQBUkBftKckSmKk/yT7fP+OSYTmKpfA2\nNJTaVM8pyhF1TuzV7JMKxcwj2vXY0Fkg+gmL0eTcsnKVItRL6CKzeoi9PItp\nhJ8xSXLVvmMU1ebdkQS7MRjBV7KEduZO/oxSxFpcjG1Ch6rZse+PSNVhP7a6\nkcRV/9M6kEmy7YXkavnJUM5rEHPBdd1F8OCo7hiQO9uPU71K3XONIECfUWrs\ngO1S4rNCqLWL3Arjv8ffbbsTrhjZ7dZkDIU8Ju9xzXj4XSgADvmW1Ig4Sww2\nHy0p\r\n=Lb8S\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.1-next.1549394930560_1549394941619_0.1569512439685088"},"_hasShrinkwrap":false},"1.12.2":{"name":"puppeteer","version":"1.12.2","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"b0afb17b680445b348d03e58f5b9a2b8c4bdd4ae","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2","_npmVersion":"6.5.0","_nodeVersion":"11.9.0","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-xWSyCeD6EazGlfnQweMpM+Hs6X6PhUYhNTHKFj/axNZDq4OmrVERf70isBf7HsnFgB3zOC1+23/8+wCAZYg+Pg==","shasum":"dbc36afc3ba2d7182b1a37523c0081a0e8507c9a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2.tgz","fileCount":69,"unpackedSize":712314,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWeaxCRA9TVsSAnZWagAAq7AP/A78sx48Q59QN0Cq6xNj\njJOR5tH7Pryb0DoUh+AHA24uJLgPGYO8xg6dN932XdnFjV3Bp2yiquZtXnbo\nAa+YoJ0s93lvM3i3KGg9oZgeUNpELFP9Nw3wTPciZZFN0eDYtAOwj1AHDenZ\nGvhmg8DvMVH4Thu2WpRKBNUE2W6S3r6tYD/Xs7MO3zN91ewiKd4ZOoI89s1E\ntoKtgDuo0dIoveDtYZyQywxdAvOf5Q11WqU44oE9bgKspN+DUiCEDragEQlO\nkWbhp6eDQDR5H/Jtz01qS3cOtEb/7xtlPCUZGZAsAsodc5zLZCWed5iFCYqw\n/einhneuXfv0AO3cScVXQ5Gia4vJ4We2O+lL/TmnXNDW6BsSq+ECrD3oukhz\nBc51k/i989r+QZGK7gtlyU5IQE3HQhIsj2g1HroZ9LbVClbjZ1wqU6OcN/V/\nMKfvKt8TMlKZjwy9FnBEOrXZ8EbZ5xSwpXgS+tx0GMSGliHdEi2lwRdhv4el\nkT5ojjGzkih+jXc/DCkiKxluAqZxz5yuZnsqA1TFHwnUbOOQxYWc8GcUVZEy\nOJVKCw8yYwhBu80pf1/CLbvu9rOTKXtdGIMPiONpeJhsiSsUM8UonIS3GrWO\noVadFXFa06VuCywPg39fDX7C8vvQGnp3ghH94lL8CxNBI5A9SVm+aLjh/dgk\n2tea\r\n=mFdX\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2_1549395632670_0.6553888411281299"},"_hasShrinkwrap":false},"1.12.2-next.1549395705456":{"name":"puppeteer","version":"1.12.2-next.1549395705456","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"b0afb17b680445b348d03e58f5b9a2b8c4bdd4ae","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549395705456","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-cFexhwCQkMje81z471D7gJU2egVZ0T9hA/Nu2AqK8Pun4RyJW/wmBa5hnBLHcKC1OGNSOv8Ey93B0o3ARgZSug==","shasum":"4fa47134537717076b9df2c91dba9f122d67c67f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549395705456.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWecFCRA9TVsSAnZWagAAu3AP+QGFqe6Li33WyrSca8hH\njX/9DM/QFe+R/F8hz83VlXoAg1jPD2oFDcsKTKxijX9QQKmNpKxlGgFCCU6/\nFXuvlDDLVbnMYoG/cNduedo5avNDZYWi//xX00MFHBDUk3FDiZfWAyzmK3Cz\nuvGxcFuBEPtj8xYCNkg28uIgkCyJhNedvEu32J90iRkcIx3e2kM04JU0ZMs6\nsBIQLqGcGzt4p6nXptj1FvWHpp56ifD4f05Z8llVaUfLFlS4FOmYdHrFdZ8H\nNTKv5WbIVj+/P0suKsBNTDewuIQeiOH10xl5MVAREF4eYQ0kG3n6f6KzgtZA\neGsQ7Lav9rrXI9H1BBJXPq2BPlAfE6ogfe0tuUnXY9cnP+hptEdAC5dWqYvy\ncXlvP6hqw+OHEojnWol5CU5aPVRax7auZOv6y+NN1GB3yc1sOAGAskg3itf8\npmZHoqWBAl8GqYBcIbERVcxuIIp2XLuI9yzlCnoMSxnssEEigNp7EP/cJbEN\nt8svU7USsA6BdX+B6WpiRAWiCi8Ey5e6xYy1/oyO0thO8XFVQCCGM2cjWkk/\nJhInSq3BlCxX97liak70c4Y7Y6HRrK6TRpxKql3zXgxUWDlv1NQN4P/DrXBE\nb/XVUdxWHSyCIvJnM6Pt+ishqcvi+N0Qlztl9rvX9LDv/2PcMN/yGhQLAFES\nP/zn\r\n=Jj6a\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549395705456_1549395716679_0.868603794244784"},"_hasShrinkwrap":false},"1.12.2-next.1549397093328":{"name":"puppeteer","version":"1.12.2-next.1549397093328","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"a760d79c86779d627612b44cae895f89bfa4e009","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549397093328","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-KGOjZvy7M14fp0pwAedLaKZZjMgJLokDGAkG5ofCV9NQ9A39CYFOWP3lb8cgwE3/Wa4iB5+mtsSSYrJQWM8Rtw==","shasum":"4572073116aa7696f3beda2da4d20dca5bb04783","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549397093328.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWex2CRA9TVsSAnZWagAAWBAP/173jXl0Rb6NlgQAyfce\nNhO4bXtmOL+V5ZELMWUH5ZC6yvvVwxlYZ6+kubJeyUloQdo74k3Zci0WLxBI\nCR+lKmOoXypaCwOsrmMVghoxcQmYjlf82aJnrPlQqJnc3iXP9Sc/l2LJqElB\n+XHXxeDFJjgThAG5bJQTxpYlvpeD734xzl1A1i40eZlGaixpfIKtb2acIZeT\nX/Lo46n2I1hE5FlA1GA0pq/53tAeZRN/QfZYtlAJyzHzif5wUJdsbWX5jiig\nrJOdKTVTISECGuLjc5pQpGUCEPvBsdF+tz9UGCG4wdLIOj9ZZgYc0wQwjR/X\nIwOqP52dewnijpj0cptJ9q/6hzlXOZ1HdbOxYC7vsQ6CxPldCLwDXIYtT1Qx\nZqVqWKPbVf+lyVV7SLhuIi+s7aC6CViCdU63s+NQ3Ub5oCvmxzS+eMjEmu7Z\nRxn1obY4/82tSmCdYeiZ4o1QWfrXDzoHmmV9HOiG6wXYgISbmvPHPA3nM231\nabwFaGzzDbFxy5F4ExbqvTKlcQ6qERM/IhRusqho9m90RT6EL0m0Uvu4gHLy\nWrJKiQB5i2Rcynu6C+2StARPSAOBNdCH1vLYCT83PkxecY2dz5XjJTbMHWfL\nJ3LLLZmJSRWTMgtd8gdCK5AnK3YdTK9p1M9pu8DJBFJHjzqfBGG/qYNHdOLh\n6aMz\r\n=ygJK\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549397093328_1549397109488_0.04849299238010096"},"_hasShrinkwrap":false},"1.12.2-next.1549399902743":{"name":"puppeteer","version":"1.12.2-next.1549399902743","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"e1000009a5ea18e8ad5cee3525f7e1944d98d461","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549399902743","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-sX/SyHwlCeyvJJM48bRiE8f9zaXeSXSEj9gwyjmNIYKzHYo8ra3YYegHLENa2Jlv2Sl4B0UmvTYj5NDIu0f0UA==","shasum":"a764a4c1f9259a211a2d8de18d1710dab2ef2ee7","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549399902743.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWfdrCRA9TVsSAnZWagAAUYwP/R92BlFuMR5rqVmxk0O7\nPeVCrUAPjBs8hbmdAGW7cB2LTPLU2Cnrodip8xAxq7N4D2xN0xmigSXsqWL6\n6HVldDbpBDASQXo+M57Xe1ZB4LXwNo27DcTQfPm/q1iidedTfrwgIXUh5tCi\np8efqlJToPhwQ1RtKN9TA/8WU9+dWF4JFRhlNKCz0WU84oDfa+jlRunxZj3g\nL6PQqB/83ZfuO2Eoeu67pjPnk/Ofg1x4VHZVDJtP69c8G1LtqcTzWIdwgCkq\n96YqwQMJ7+6HBKbedGuPDAPOx7HgeoF8zB5v9UztdnsIR1a62nCSEo02n6ZV\nvC0i0OpoH8QlItSAsRxPPRyngQGlNFiqf0PclJj9sk8yMdpcbnzCZgCXMJdq\nEDfk0xr0NdxMgtUatfTmSQtgr+bcDdcfUFD31XU9KaRszR4HsU0uu2Btd3tJ\nyssZVV4uQEIJ0oxVbUURgwqvPy1y3S3zUTk2k0zB3oR4l2j2D6sUPYhGtKMq\n99Lr02Gx0Nf1HfcqI9Hzw7zMwEBeUvSeMlSMIjPIE83//DrCugdEjZ+oxGGi\n3qxgYw9LyElN+teIN7oaONusmIBThRojfX2HjoqH9I479a75+8NV/Cc1JOy9\ntMSZQlSDw1mf12C3ZBK6PZwTgOgiIorqesnHOytb3pS28k63isuaaEAn6E1g\n/xGC\r\n=OBkX\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549399902743_1549399915144_0.4858047832672472"},"_hasShrinkwrap":false},"1.12.2-next.1549401617806":{"name":"puppeteer","version":"1.12.2-next.1549401617806","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"dd8bd6dcb1e016b387dd53139e12de5130468cfe","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549401617806","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-QoVwDRMyUyaW0xtCh1QCk/XR8DKK9IX3nTJosuGv4PkiXII6beYD5xxy3j12fwl8uCfRBIKHX1M32Xgijfp8TQ==","shasum":"d91f533bee94dce463e5ea629676d7e09a02dc5d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549401617806.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWf4eCRA9TVsSAnZWagAAZroP/1dE81eZCTlW2ROPasia\nHSAX8Oxh6DweyeOSTdE7t35P5Ms6hIRvmrWvzMbLAdZoySsd/1fVi73TvJe1\nUBOWLvib+x4gFxwPz7TUFi4N/62BPvr1vfYnRoxAC+hN5HmCrPHxcYWYB4uF\nPfGGJBXbcp1sGWX+SpREXWsCBRYZil1qFuvVHyHZTaESIs4Et2aEP1zKEhrM\nIAPkayapev9fKtE1fUsQ+mKxilCCvMkXZw8VR9AKX03Q+Am1Limo7eaeb7oL\n4FAHyffNrTGCeGt5P3qFOiSeRhdtqacJ0cGQODMCwPq0WE120ziQO2Bvp6Nt\nEl2aueQ5ig8fkZW3jvs1RZ6Gi65gq5YOZdrxB9FMQLxrOYTBZL178aE4jiFV\nelL8KphTPVMeXUB3aBwfJqkaTgA5H5Ir+zLjMwu5GyWY1JJdYuQkcVKaD5Jf\nSYnRrHZ4Dbkq4Vlwdyy6Kv/Wc/xEMEOun2kB+FNNVJ37DaXI5V7KFSOokHem\naHfXaKiyGOtBwvRGT+n7wDwxG8fn29i8iFPvtdDh/rAZTHmxlRzHgqIPX2Vv\nLqhBp7nUtTyRYv720Msbz3LEJwwB3G/NSwCi90yfsZt0umsGxnUZShhLIPCn\npD/AgMUCgEq9GndOXdQhFH8/mNjNgc0w8LqOUtgAXsCG3jv/sSrabuMBPbLN\nPbfq\r\n=mkoy\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549401617806_1549401629450_0.6489570174671451"},"_hasShrinkwrap":false},"1.12.2-next.1549402405484":{"name":"puppeteer","version":"1.12.2-next.1549402405484","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"28087c291f49b0c8ceec550a57ae3bf1ef8a22db","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549402405484","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-tqMd2RdAF9Z578TbbyoRD4K2Gl7yDPr6qEVtxHd6Jw59Pv7wWOGoDoZ7XLmvSIufVQkZgG8VM1I74eiexGPKng==","shasum":"9c38b47a95053eae90fc6ca2eac7630f7dd25537","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549402405484.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWgEyCRA9TVsSAnZWagAAd1kQAJylOMalSNtHdaYs1Ahg\ntRn3eYeLOY0mMWiamw2PP3SYf65VqEy5yNV00Jmb01AlbGkg+ARKzistqCVm\nySFoK/PtQUz1K7+AuYdvdJPlkCs8MCXuFV2Bz0KQqdaf54q12SHXafhpAvEt\nsV9Ia4SDGvU9J1Ht/bcJmBZd+OxKGRzif7lmSpUQQ3Qqp9igBC2g/j8xEHkJ\nKZfRqZF+TOXHIsjdbh+ERzxOX1ZxpmREaicQDw5X2skRowENuyNrvHdMlhXR\nUqbnzfzAhCrNFLV/VH2mRbmpzMQnMlEsGlVLoemXy+om3dmGLXS1HzJshOHP\npCRnqGqtX3Vj3slFRl1GjD9ebbQ3IXuzne/0nCvU+Gz860/VTGN4ZGgr3AYs\n0dIVSlJf0/HGZAx36OWmz50gAYL6nKOaOX4T+/jVQ2F7mxqKCrbJyivK6j93\nuNOnxNTgAynSbie+gsB8QoRmfEiSFq3nxzjJ4EvfRYzQ6GdXfTEWn2Le6S4J\nmg/ly9ub7DRhQckES1H4aeYSB7gFVV+53P3jWulpu6F5lpgvPTfStjjLAeSi\nEac4OxijwlhPvqpzYH5if+OYKwav5yIIqoq4AwpV9CjajACrgVg8GAYu2XX0\n8FDa7KM+DzGuzq+PNgNTeiPbd7aHdVf7sL5J/gOmQ8faDfB4vx89wn0qCDH7\nMhn1\r\n=3nWa\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549402405484_1549402417405_0.9149475750725915"},"_hasShrinkwrap":false},"1.12.2-next.1549403066989":{"name":"puppeteer","version":"1.12.2-next.1549403066989","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"00bcecbf727db405303176d722d030729a2b1835","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549403066989","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-aOAlOgIxwY1jKo74IqTdTIXxucXuP30aKYGrF5UpbT2996vFJyEz+iqt48oqnrmzJjoftFe8zYusI3Q+SDyjRA==","shasum":"06d2c8702955572b9ecba937f4e1ba4ca93e70bd","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549403066989.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWgPHCRA9TVsSAnZWagAAfDQP/jPHCFxtWPAb+bMFQ7eL\nv37xwXu4kHPRWSyAmM0fs4lEHG9Lkceb7sdWdedesdM6GWBBLIzZdlnCXkUy\nv320zwElvkS6KrOJMOA1jrWu2bq3Y7HIRQrYO1DPz8HUkFWkYRbjbun1267I\n6Cc/7eL5OhiDiktOPR6Kahka917ZTzgg+jHwUfYlWcazi/tMLxsrJWFSEYxO\nUkrwEUAkOqtWi12eEiSR3jSyVRtJZe1QwUQNcuclWg4gPGTpzu0nPM3W3ruN\ne8n9CHNXbCUFpAP/QZOKRVTfq2P7vpx3IToKGoSwuxLko799H/C70qiTdlG0\n7wDty8wXBh/4llJyJVPBSj00t+0Nm4jd917QFzj/49XI9U+kmDRjwYiCtY25\n2T4w8c5+/KDl0JPjIXp3XCshaE5NpMg27LxVfAoj0venslapCnc12T1i/p2o\nzvJRNQgyEa+ybJp3acsExHbJ5TB/V5VHGXCeWDigUMtuwQHksIJSWbHuEGrB\ntp240cqI85ZOhsRpYo9IT3YapjPrZr/Krxfk/4LrKYfujOy681+J5JOD95zI\nyX6A2hK8/7Zg1T6AFszOW4jL4qDKOC+RC53MAW6QDwiXSPulRh7B4Foi7/vB\nPBYbG18OWD5686w5qEXt5Vezj1y+AAttS9jtWgiidVGdHX7uoHdoFEg+qKgt\nowcR\r\n=a9XY\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549403066989_1549403078313_0.008312031766462447"},"_hasShrinkwrap":false},"1.12.2-next.1549409507651":{"name":"puppeteer","version":"1.12.2-next.1549409507651","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"a210dd7ee2f350ffabd7d69a60f96b872b861087","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549409507651","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-RW2WkIQcNK+DoVD1KXZIU/JGVXwNB4FYzQnlPDw2HwJpldZsjutjSbfpoI4A9/9Ij7zvwTNtI4DUfo+FOYbFsQ==","shasum":"b3ddea0f45d453fac3bc47008b44e68c9732f8c3","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549409507651.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWhzvCRA9TVsSAnZWagAANeUQAIIqUrpSn+8Y4bcTnRmB\n3arjrzZ6nCXC5Bk1ZxcpoCZbaxCGJKaLVh3TG8Zem6lRTuwypgcwykZDHK/z\nxy+wEusxj8CdYRrFoeTvdBVVVjEfPtezhhRDP3L3zGmtgYV99kRfmtYBkf/Q\n+pnWhhyyDhYtn4gxGZ/cqaVdxov5pEq3C1okCUOyBOn2HZ5utNhkMUmgDEES\ni+Olc98BPp5YnPAt27HITrAhhBSLqv2PZbXA83cO6ndAbWvsQ/QsGkfDuxyv\nqA6tONjYJMW4LsAU2YsNPOApDVZVOXq5w0grHvXNlxYSTZ3jaQsYZeqUV/sx\nNstjK2TFu1QbTUU4+2jwkOQg7BHKjczxxVglHEXcVfta1NzeP5C1EMofjs0J\nkj012t/OZ+27q/tlYpquv1oIcsVzjsTMz1ViiTOaYR0i6BeyIygF52OwQB71\nxUuASt1LBTd3d8O/KfkYVCgIny9uWl074v4WzfYBfM/WuD1pWn8kyM2bRdyJ\nC0T1DlwlIu8Q6uKmbl1f857xObBJt7gLYQPezjOOoA0pfNONV1Rq7gGhoqD5\nzBuiPzSxQ1PWtsYswARlbaXyRQuFZqji3Vh+J5cz7RAV+ZxtXZFxbgWpQy97\npM4iLXzrQ0MtjUuyfl7RUdL88E7/1OhIhYXIZyMBKgnNQU7FZ0DSisw+ULtk\nqkj2\r\n=98ik\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549409507651_1549409519263_0.9149731148760412"},"_hasShrinkwrap":false},"1.12.2-next.1549422350612":{"name":"puppeteer","version":"1.12.2-next.1549422350612","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"bc71e9236d2a0b8ea82f5670ef6c116b3989845b","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549422350612","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-UbDpK40keGLfnNQTj8FiOmhntzqYgCMnzMRrD+joNuBg+euONG4xKrbCG+BifgwaRjf1aRMP6Qt273V0Tfj51g==","shasum":"7610b542f4009f1fce82209e2df1f36bf322833b","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549422350612.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWk8aCRA9TVsSAnZWagAAfCEP/R5guzoOrHHsHegCMvSk\n6qWUbeM0ro88JDu8e3VNEQ7bVK95ihJKwYEYhFIvjaM3ME7OP96iZahrI0Kr\nh6zNXbtL7I1q0rXlpGTBH3RywcR8CPygPC4SFSCSb1JVcT+RH5Xa0jXPQE7f\n3dHXZhQxBA4JxUsYmTWlmqRqd5PuUO+8qGDWEePvEr8lweO0e35gU34JNav0\nFN4/5kPmultSsyX0mqScKvf01KuJa6YPZDH2FLA/kibbxpWPTP57O26WGxpG\nY9KCWqQAb4C4NTP0XE01GXf+ay8nMH30QkT2iS8W9Br1qeTLRBBzHKvzjQEt\nlYiOFX433IX9VJ5DulrPoZ6Hb2V89XoAJui4x0UwUO2F5cVEJXy2j536BuvD\na3LGvZrnSY0hzVauuK/gf9JzMJN+May7Qf2u0mDRhI+UEr5QlKdcj8ap74Yv\n691UyiFJrOEvyonaiHLvmBlC4lkv0HIr8UWSPZDUUNav/YGU7upM6rihW8Lv\nisn2Tboh3QHo0q8CZ83vhZGIToRx4dG3pdTGCsKibDvle+8qHwmDlu4xIr5n\neURhUELlM3SZ5QakXZKnY1njmJyiGoQBYcB2bAWdub2C5PmEA9xrlfGLRa4a\ned/tmM39oLxyEhlcFy/8fnhnf4fJFot8LKpcMaO9YgO8cWcNFvEeZT1YaDUK\nHoSU\r\n=HsTN\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549422350612_1549422361970_0.15985645767400225"},"_hasShrinkwrap":false},"1.12.2-next.1549425183362":{"name":"puppeteer","version":"1.12.2-next.1549425183362","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"86783c24953ed41fea99ed359d5ebe9ff18fda62","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549425183362","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-JZk8R67pKnU5hNSeRQbdUsn/DHupY++Guij1c6gbspCVH1eBy/3fWkm8yHQZo+uHoFa1YnytW0pb7qEWNGyyRA==","shasum":"d5bc4c47e246a3ebf9dfff168a867776db9c929f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549425183362.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWlorCRA9TVsSAnZWagAAKawP/3lvEnpiPThzNiAj69RF\n7l0zgs9garTDSLbEbEZnBtUCB4RczGXxPswP3N+vhMuSyZLpJKL1nb/2AMQZ\njvGOtpau7lpV7qwmnhXNiz7fyNoY322h7PVi7Uz+T+YsoS7x129qIezfR0my\n/bQfj1fES/R36AdbCV67mptZ99WM1gizGZzf/p2egX5ExajjZ4Utno46fkod\nUd11uSiW2lu2i8X2k6nLwWD5b6hO5Feq4JJX6hVbhMOwZYe4mPNaHI/XMSDb\n7mbya1sILVnucPbM8bRw6sifJ/9l3KsKEuNUrTeWwLFHmdn60MnVVnhtIIQE\nKojXYFlN+jBRGIxPQv3FRt8rRkcNcAXg8rcTcbj1S8Ko2JZt7qjU+orBjVuk\n/eeMO/trUlPEmtA3g6SLeNGwzIlIsr6QmahNNUGLMDsfh4BSm3QC6w74/JGS\nQ/vqCH70VktkNdU2EKk7BZbkjcYiyRF4vYD21J3m4c1fpAUL9OvQQnqPrUJL\nkR9sgIjHPgLq8bMcqAKhojB75L2wGoklYo0XRGROJeS7C6fM3XyjLLdxW4z5\nbsfGH5uM4yfkywF9p//uuT0XRFAN6txIyfsm+8lOGxsZB7hyfh47ti6fFlWN\nqpbtbwAq0KtJBfRAk+zJ6QbOS0LkeP3IbdN4a5pE+Zb28dX8oNVDKI2dqhu0\n/wDp\r\n=hCuH\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549425183362_1549425194670_0.544266562115602"},"_hasShrinkwrap":false},"1.12.2-next.1549434954882":{"name":"puppeteer","version":"1.12.2-next.1549434954882","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"14fb3e38db7c97fc3ea76c65e6f219b0ddb3b54f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549434954882","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-eE/FYbWruJqs3ykpItDRDZqtEo6o7IfMsi43+JV3E9bi4YALedXcXSjoL98rVRYPuw6kaV6E9Q/pgyXAl5Eixw==","shasum":"e8ae2b10a1f9fe3be6f8a6a1f10ad3745a16d0c6","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549434954882.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWoBWCRA9TVsSAnZWagAA6dsP/R6/IGb303G4eC7Aqv/N\nN5s/cdfLsz9+AhUxPO+BQ/tigLpiXk/EOKGPSgEyQYNPvbBksqyXTpG/VvVU\n1xQatnVpb+wJASdz/qvd4AgUsQ5lZnGJLTddE9M1ZakkjtccJcGbwfjq+t1U\nBDxhPfilahu5A3nDFXqoXXFTn4cHhQyxtBLtGCfOmKxDD2gVX2KIt4TTXeLq\n5iGXMX8N0w4sS4FSnSPyAmdl5u0DiKPLaBOjanb82XxRQleZpY7L2xInPC7U\nT1lYvhLI4Tn9pTp99P9V79ErBgcKXSXr5cyF94e7xI2XVYMFkd0g2NUv6hGc\nepZdmFOAkyatBFEJxkWbYC/XiTh/eKqySsepNUvKtGDbdPS69k5Ibc7+fDwV\naNjWosa1zMnr+/Umrm8k1E0JTdfJ10E/O8KJon9yfCTI2TRfqawpmAOGZxzv\n+uIBEJCm3SQ8fPAT7i8x1pTzSPb21UAOYhnod96rpSAsE12G4I+Dm3F5IV/N\nS2mIM93FGSd+cHHeKBOrpxhRy2Yye+XLAWu0kg/MtNdYKGXy7k9tbk7PPsuj\n5meprBXV9H2t39furMfvgX6XOYn8ExWaplhL5F8njfaYmL36qnwhHOnsxIdS\nnL7wz8Dbo5DPNB7JzZeBq5AVLUagM3krOPnHSCQ/2tDvoAdF7PjAQnXidfkf\n7l1h\r\n=JOtZ\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549434954882_1549434966125_0.08477464193206341"},"_hasShrinkwrap":false},"1.12.2-next.1549476612045":{"name":"puppeteer","version":"1.12.2-next.1549476612045","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"c3b661943209b2f541f920357306bb4794dcd1e5","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549476612045","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-ABDQ0GTHqSX4+AwNw9ev7PqxHDOKfR6x2+NlI11wUvYg74tGtEWnzpE00KhFw7zbGlebxWUJdXc2O2D/kbm3KQ==","shasum":"ad1f01f211112556e17fdca20e9f32f719cb48fe","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549476612045.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWyMSCRA9TVsSAnZWagAAS6AP/2ttzEdQX3SUpXC6/XPB\nlHVRUgbFrM4gYkZ6PcFju22wtBHWkB27/DvOdXuEHnfR1Pje1haI+T5ez1xK\nX8pOqxkgd9HEoOrsp/nBROo/nTQAQ+d0WXmIlBoJxWA7yOkZLaGQwG1UM/lE\nr+7ngCUXTMS5qL0jouJWjwW23V1cj6mwaCSb8SfBpPn09cLM9H9tKLSsBSZb\nTgde1deqUDighy//+/yAkCnekYfOlO4rs8gU21BuPAXabZkT2mG4NO+6Kg+/\n+b4sUyYEwnDhTOQb3KdWmfCQ3EKdWrb8pFetLenN5tLPYPzkBwAgAn4ygkp6\nQ6jDVbC0Qfe4DthiWH1BCzNpfs+/Pul6U8UUFnhAFeRUdAEsV5vIiPrFPkDt\ny24edpkpff5KGkbsACcvKEJ2fTvIbVdFtMp9xgPpy0Bo1pYQ/Qx5vuRzF53p\nyEgsqW7ja9n086B6FyPNsbTfHIoDxzXokhBD+eXyvsze1ZwVG2SIY75RPAOh\nxaQxCxQp/QHG6jSGD//hSOy3hAhgu24biCuCCZGd3tW5TA83d2X2nJgUmDVn\nTK7453m+FLBRgrW7xV3+ChdDUpr+fvBN0QYiLSdwxklN3jdJkB76adteYg0j\njLjOC8Dh0b0wY0FaN4NbnIEyagCZr2o5b73y30QLjt3iYfDRSuMgrH+Mt+JX\nTjPb\r\n=RqgY\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549476612045_1549476623412_0.12363209627227034"},"_hasShrinkwrap":false},"1.12.2-next.1549489957515":{"name":"puppeteer","version":"1.12.2-next.1549489957515","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"6887ad881ae75ed19656fb8462a966c3ca28ea58","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549489957515","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-BZWh1ed1zQQQHvaySrJDtjv+1Xxi9AiWMN69WG9A4VCOPIRXCGGBZtFrQO67xcAJYyLNsoAXR019J56u66XxCw==","shasum":"c3f9bb4411e9f056a158bf0ecec9efa28ab15eef","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549489957515.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcW1cxCRA9TVsSAnZWagAAQSkP/3fylon8C6nNaOzwM9gQ\njcIl16fP1W6/8hkDPlE4z9Id68FYhj5thnpQusnlXvEkKn9lJzaByJOgP9/C\nJfh/QN+bv6w7lLSGruYA9tSojuHljOLFY7U3Vtbriu4TXRgqKJsTHgm/fWZo\n2eryI89DVCCCuNw6n/Ee3mdkn8GtKUhmHTtnrp23gvQEqEK+y10TNzQJP/vh\nmlxPyMzJXbi3FADSJU7m9TdbFFheuo98/uxhpuXx3GM4y1G9rzHKMZzsxElY\nk9B9iOonLakTKSdSPjPrX1c+E323dRSTERwGNguGXE8ohEeNfwXGfqNFf16L\n+ENX3brpFcOF+wjUdrGALQ9+2ghEIpaMu2sDNRDCb+rbmVaaV4iFIpwBM5nn\nFTf09oly0kxYZEG1+0UKrtTRVrP3MzvREWsJkT43ZGi68wddH7vdD00KQZla\n+0r3uqhuB9vKHkHZQy6klJpgFnDMQ7DJdqNfz5Cud+HUXNFkt/KyymW5DoAN\njOVKxLXJ56H8dPRHiGIOAVGZhU2bSNVa91phAczVxqSUfOHNjZFWNnTWbz3y\n7ByzFdhiFzLCKlKRhRQYX1rcBYYcpCFwxXEOTHeRWuqrlhcthIp0uIX/6d16\nbPKHExqV8kOAqwEHdD3UiU7PqrJu3BZv6Urw5x6OYWgMixKRfUaybGjekQFT\nPy2c\r\n=hGxK\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549489957515_1549489968989_0.06068934647134605"},"_hasShrinkwrap":false},"1.12.2-next.1549492279061":{"name":"puppeteer","version":"1.12.2-next.1549492279061","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"a762dbe96f80cf18d31294625ff79f52dee7f0f2","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549492279061","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-Q/OGISq7r8mWi5T8RzLcjvnv08cHajU36XwOM9fNEunIQqCt/BdaZaJ2s3gwdOaQX+KduGRlb0Zn0P6GuVU+JQ==","shasum":"109a2715bacef82998424a7f695636377da41e0e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549492279061.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcW2BDCRA9TVsSAnZWagAAtJUP/2zvxRVX+OJh6oyHEpRg\ngtjdaaCIYKEigeVkLeGp5MX+nVlzE6AxCEQAwBCqVKsMvu7Iov/GWp+nZjhT\nBCpu/KwHakd34fGL8rx6SAyja+/Sts5hcUGLe2Qny0FS3Lv/d31FhtYuGym4\nUlYzyp9Blztj+0qc0b9o3aO1kzX8B6PbAnx7V0JqyjVJLhthbn3wyU5KGdAE\nbTOEqw0QTz0GtGrui/NEKG1UBM5B3AWVikM4MyeIIfaMVZdveWo/sgvKNQvN\nX3N+yQXWANWaw6t2vAvKmG+VZ+jbdyd+uzc8BBzRyKqS2pcvrVCrgsoowoBg\nGeSwiJNxsDvJ0E+U5Nesk46zYc84FcDxJzRdalF2FFryvXqeuKLcTJIVBNie\n057UTog+kkR/A+1IXN0+LeXVVrWv1Ub6qKzuKfAAbx9BZtHKRpTk1FhzL2i5\nh9NVkqzbhd8EJqAAgmKF22sGaY6yXJ6VzxODie6LXdvjz9ePJpmlZUfurqdj\nTscgKGlKcoLcZJPWL5fbSvqQQvcS6bjhnBpkAPf0AK1BjiS0JihYhobNSz5p\noHKxf03BFZ9nF9mAiK1zDzNH1I7dlBqLLP09TVcK3bOEWWYAzumcO/O281G/\neIM5z1NoFUFcmm1rJqHm9kiMy1Y41m3wiEhNZnJ1YVYcwg6wYfH1WvCAR+WC\nTY8B\r\n=bty0\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549492279061_1549492290591_0.7962111248289478"},"_hasShrinkwrap":false},"1.12.2-next.1549500038211":{"name":"puppeteer","version":"1.12.2-next.1549500038211","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"96792793eaa66d267b5af36ac619bcceee3a9f16","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549500038211","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-V4yTKUQi4Mf6XYkOrctIMLxM2MUMoghchfCp2t+SNvgwhQxWWg94dGEdIJIi3Wj5+uztE6bPUGm4abqppQX+eA==","shasum":"15847ba7755b2f2ed0b30e023a78e0fa0314118a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549500038211.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcW36RCRA9TVsSAnZWagAAcxkP/0lbPKLsao/5nT7zVRbh\nnOwCnnxWpg4wUtC55qcCqg8yK9nHHA5QSGKJ2ZwUX1DQn7KRLOyDvr4GocVg\n0/MfCDEGxjLvAf8jRQpavPI8Aywd1smOosAcyE66PZQdeJ9R1IkhyHCMeRAb\n6MiTIU8oYqylg8yteBH6BAMvMtJq8GBTAjINk67aQKkNynagP4pgH+nsCePs\ncOZKil4mHmf7TazZa9tW5OAKy8huld+UBVE31D6UhLf83TlHt8aQguWWD/Uz\np4q0MoDaxeeCWPsZ03l+kbhonpVUh0CD8/bVGYz6Sh8VJfi9INIFzAiP4nwn\nOAD3j6gCvs/uEhDRHQafSZzmv/0RAHXm0eJA+plQZY0KMiHv4NaF+DdvIFL4\nj08Yd8TlM1i0Tk0nv6Zdq2UiXWaMbgtSVVEM+Zidj7Wrm0GsDFUdYFbm0slI\ngWrqUzvlgRncA0Co3CQvlPIekStohOGTHwpazKbY4uFmkHDMwDpsrSGnWhLF\nLjRtZxo+shNgjayTcsIQEnE7T7mGCfVOC+TltTTUv+c5gNDyqOB9eT1KXvaq\nEcEqk5K07tS3xOeVxqkFvvwQd2uhQ+FDqkSsK4chgNtGRLU4d85fu0IMT56u\nwxc4GXoswTLd64ibFM1l4ijX+wJNTu58jQQ644FHl7Qp2G67XW9kwlPxbHx6\n8ZpL\r\n=uBFj\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549500038211_1549500048990_0.10389230225116974"},"_hasShrinkwrap":false},"1.12.2-next.1549555526593":{"name":"puppeteer","version":"1.12.2-next.1549555526593","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"609e7633819485e28672063fdd79137a4a069bc3","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549555526593","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-qoSWY1IhAlHKJtzlXmoyNQxkFzA6hBknQddX1sbIHKBV3rapqF2P4RpYEf1fngy9HI6ZykJOyTUwYHFSwPleWA==","shasum":"9151ab858786c955ea10f89d5c8b085ae09dbf1b","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549555526593.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcXFdVCRA9TVsSAnZWagAA3VEQAJnsY7izX4ymKSbPwN06\n2Fs3dKW82iq/U9bhILximx8YaC350LihHRBIf3a4146MAWfSG5o2qMyf8Cg2\nqkrScH/sin+sQM91oDzD1irVyDsTTHE9QriHnl7+rti23gNQTKZVBHbGzkML\nEXCMiDTsngYKTr/vS4rlyosRBmc1DhNRMdfal+d+ThyrDateOB/4Qdrrd2pw\n6pwYVYYTFoR36dtlK9N6uKvfpPlzW3yRHW08eSL+fW6r6iEJa7t2uqilIz+g\npP/ZdN/Sq1IMKzh2r9C98E6DRak2zL019nn1vmwDbO2gajpB9YzlH3TUaglh\nM4mdFR5uR9LwRDbnPe9QnNNPm38iP8CeuxGreCAWhCUqK/EJPWm/syqnl39i\nJY0vpm/gNAS/ANGD9JJZVH7dEKk2/z1hakJSvRWRJPKO3WazCZzid30CsK/d\nB2xwUkrgFBIsTCwlbxV5nvJHb6sPMpR7b6uYAFtO+NeF+tZFu3hbvHpgCO/0\nYFLa4MLHPMkqGc1r/Sdj5wZv4YaqcToMPzCrTi8FJgml7gqOtggwiXTzZlMf\nszYuSFOmRban6yE45WtjGIq/UdtXisBfe6uFkKnUG++AjCSMmAdypaS6M8H9\n+HcCvkCftHkxqux1NhNFTxppbsJqEON081Y06FcQ7swNEHKhjYZhr5cp4tGh\nXl+N\r\n=QNFL\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549555526593_1549555540161_0.8009852781661919"},"_hasShrinkwrap":false},"1.12.2-next.1549556415428":{"name":"puppeteer","version":"1.12.2-next.1549556415428","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"76eecde8232d163f6927c869a28710b12bd4eb74","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549556415428","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-1tElpZU7o9i7GKyTSEMNbhdgQR9pU1KjAMFR2/02XNwgB1fIkkTv4x+5F1tdIz8pJfvYWc65I0okCUUg5oaATw==","shasum":"717a0869b91f38cc1d61ee1f11024407dc846640","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549556415428.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcXFrLCRA9TVsSAnZWagAA6J0P/2Y121nYY92emKTWtvT8\nWlru7O8M4qqbb/H2diO9Fz5xBQecTmBHVnEaG24yK33Ffy9LKs7/wYCHaHRb\n6mM4L+ElElSt7gElfvhYGO+HJrRMIvY7vWX/d0UCzaM46lJgJoVX4LecECTF\noYwi08BKCWhyr8lCVXAR3HiDOi6MKnj3ufCdzysdhadSSX7aSsqxmpMy5VZc\nVRNI5GquexeZBay7pXOU49hW4AkdclnnJ/i8vD0Z+DIEkdbMiXwtlSTYjbe9\nHK0DxyZ87njDPjP/zjyLXfmxGVmQp32N4YXQ8+MpsYzAJvUBOioZoUpJxw1T\n+xVuvstxpjf67yBTlPCY3yhF3C5icWRmMlifovnU6bm67duzZH38tysyPMjB\nf/UWzxg3O+qfRrwiYRdZTJrFqbqgbcSApUBLaawJ8KcqNuxRbicoOxYilUci\nwtOmKHai6Lyh6nNTnNV6qB43Q7dOt2EVHn/z1izS8TLK9w2j+2/E5oq+vxiq\nw7BZ2NiBzgv3yCf+/epsmKdEm3ulbi/unGaksa9YGpNdGig+rQNYgmIPdXEu\nchrXTvK6SBwGXm15tyMLMVCi0o3rKnwB/HnM79WpL/pODAMt80DsGpEgSfO1\n2tLYYAKgwN4WRgCHM/AZEf35FOvrBU0k30khaI84CPo2IbhbGx/xP4ONkWpK\nIW3z\r\n=IInr\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549556415428_1549556426503_0.2945379364777443"},"_hasShrinkwrap":false},"1.12.2-next.1549561537920":{"name":"puppeteer","version":"1.12.2-next.1549561537920","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"c33be4cae4a5a33e610d36a0d9dd53eda390dc8c","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549561537920","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-Emhxd3PMhQBDkio7nhmTuIC6BvKpXmkqPE1uFNewQeoPhO8TQ4jNrELkPmXcY7EzOgRPBCtJku9gMj8WtJRp4w==","shasum":"72101a17309ca4d3c62b0be70b349773691b40a8","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549561537920.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcXG7OCRA9TVsSAnZWagAACJ8P/1pg4fnWLyja1RYEF5K8\nP4Pl5oW7lbuwS2i6dzJXgztaW2zkWGD0tqjDuhEc8qmAFZkg//bjvisVwI6b\nYUvzIciPLUX62FcCRHWLrBSR4Xs+ptFbOWMltTiQ/qq5a7BEgpYDTQAtKFGQ\n5Dvbw+RkGI+oCdhpITXsKh+hH/d8+InhOS0C3E9oDf9yt6UdBbvwfIE4Ybug\nq8Ji2qBh00U9isZGqOMTEMShe/+NJK7cZfEJcoNISLs1PsjEtQU76mJVXEF9\nkyqblYsN8FM8EXRrEe94RS1/XmpCtnMab4UgPPteX3n9jnxEvBCiDNSNIzob\nu2lE/UoognAUM+t3QzplRJYVDu19K+nFrrYDGqTiqFAinSKUeEGZDKwLqIdU\n7t9CyMNCPzDxmb1Wc3vQ9b0O4J2wCr2gL9TsPCbTPxSx/Sh3/fyXBSvWuBhN\nMJIDM/507n4JO/TcRLS90q/bSB/y/ksATGruuMyrm5qwwXjmWCOAHqSTvdxn\nIt6Hko/qJCmS7DUERt4qxrak1BpGTljYYyUS/7jmLhPCxIVghhfv6I/PqJUh\nH9PdjOH6S3Ad15VzcZf/77aijDjPqo3Dcj8YSlCu6g8ywNyHRSuBJkMKlJlF\nzr95Ux3Lrl02xKqiM22AuWGtuX0+m2LNquvmqfsBdl/QFRR6WbsiihuQrUpO\nfacz\r\n=w1mz\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549561537920_1549561549835_0.9462459386134243"},"_hasShrinkwrap":false},"1.12.2-next.1549575152419":{"name":"puppeteer","version":"1.12.2-next.1549575152419","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"9216056d12c70d81fb81001e564bba2f9cb67b8b","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549575152419","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-C4kxL6ixyjqExFUwjJS2igXlQPFKnM8YpyLwGdxMnlPzkIGXFfQGbXcAJNpA0uWx1ca6+NiLc1dirMxIXk78JQ==","shasum":"6f767f3cbe4d7f04f0366a66546e4c553ea6df25","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549575152419.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcXKP8CRA9TVsSAnZWagAADY8P/jA+3GUxCVpfC6TWVkGx\nTZ9H6dBJ5oohcsIr3b+TQyi7cxnS4RZumuAxLvgQ1zQaE0HwvtlGw8ssDU2t\n/pO4Tibrb5mOmSRPRZDSXpGF3gpaurs7GZyAL8Cspo+1qm4g6ePGshofGS/3\n2NUnmuG76Ws1lOR15RuJluLqYExWDew3UD/aOqv5VVGVTpXrCwBOjHY1Q/PH\n5fPqgHeCcKmS2rAi5cLYqzLEr7lPf2i2+Jg6g6qBEsILXfNKMGdmuZpd1z9c\nL93G5lmP/NaUgWCJBH41P7cp0DzKuE0LiBWTdUyYiU88v/J0sg11/EoHZH39\nQ7UcMf7/Ahs3dIpf7z4D7J2JOV8TU7oRdpzsT2X0wNErEOyvpSbApTASkYwX\nxHgrp+JXgrc2oYl3t+TN58TAt+uqqvgCobAn3GRer56y+ytD2xjWPLatlSWz\nGuH/4s0L17Ffr8wkbZskP12iL0nsDQG9DUJ0Aa0HC7+0ednFA8SWmr5rB+EK\n8nSdS4KJcs53pKEHoO3ssrjvYU2L1YnX36Lo/mHHdUeMsRlIeE/J/fEdf5wK\nIbyna3GB1l1eAa0oeUfLCmQohnmk6ieKt+5iS7dBdy0sj4Iqf7O/zdKIFe/e\niaxLqiUc/L5vpLcx67XvRSaKIMjvwJeCZbz9EO7IBwkYo3A3BqpyGQCHd+8o\nGAFg\r\n=s8Pm\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549575152419_1549575163969_0.21518665170718831"},"_hasShrinkwrap":false},"1.12.2-next.1549581910223":{"name":"puppeteer","version":"1.12.2-next.1549581910223","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"6b18e8cef52bd9667ca5510b136c17e82817c762","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549581910223","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-OFA3VMMk2uSaklmMILwwWaiK1QnblMmo4uHTS/u8KT9XSfqAvdMRPYMq7GzIDSwGkoHkHP7sdycu0H3ZgJlrBQ==","shasum":"ddaa6599a104c9f9d3c8e3cf884d0704503e3cbe","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549581910223.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcXL5iCRA9TVsSAnZWagAA2d8P/i0y8k1tEKgEzzEaKGjf\nXmLMsnNlhEsl/DSV461EVzSAm+o0/FBKMZus5XCAtFEPGj59HacZ1oJIZAsk\nsi9pg+5q8BOWdiBpOZ9bUfgqPCUrwTS96GOugCTM1ik2uYvOvJbjbCwJgGV4\n8MdvhXjIQR3HKaiuEQ5y90bANB7kO5kePGbrOh6nlz3J35s1jYmZ8xJijw/U\n6+quVAEpwBVPinEmfvZuKvkQ24XBJI2IKSdWdoPdCpNp5fGuffC0xrjrckfI\nd0fy3rCg2UdxkLYmMTKYh9zYU6oAx3rJ0ybVJLvYhlgG0eeOMVwWkR0dPy2w\ncGByvR8nku96oqG4J5vVnDwxV43cKiSuSJVOx2Yl1ZeFOpeMhjoLYplso5Hg\nNbPG824fgu0lEOXdB0PxLZBYLbD3XQCTVL7OkjyQW0yUXDPhlG/x8eG8Hlba\nBx0USpKaVziGeEMsMD6WOaj1gcznDgyefaQEEqH2P1qtTQS+DKGNNX1ua1JP\nHq5q7u9PbRY1H64nIyHOjZetyG1jDsWOeiR8d6MAMTdAefhokwSQFrS5wdId\nk9zVAhxTwqTTWXBvdZ95RoUegGBC1I2CyPr4OIi2OCMhzbgVz5LZ7pV4QJBx\njW1ciQt/1vdTCSFktVOoEL3LiIrINGbRuU/YL4BOL5kl6ar9cJrlJGHshfE3\nOKtZ\r\n=dn2/\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549581910223_1549581922048_0.5297124315185711"},"_hasShrinkwrap":false},"1.12.2-next.1549591798679":{"name":"puppeteer","version":"1.12.2-next.1549591798679","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"72c00474e7ae87cf92d7047711f53010c3f3d2d6","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549591798679","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-FfzDoJdtEgjRAwsxWC18MSYd5235gD2b4vF7FLaU/pIrY6i3Zg3VhBKOAb7VEB+eewt9/P1dUDu4pKIi0WD9bA==","shasum":"0dfe053655b0b200c315cf23b70c3d797133d2d2","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549591798679.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcXOUCCRA9TVsSAnZWagAAZzsP/2+z+pjkgc/cQapSTRPr\nNjHNiB63NEd7KC8vE28QUURju44+D6CHl40yA0zS8OqFHobup4TKjfr2RXCN\nGHYP3rC6zSo7pCysU4ikirpXr2dLybDxgUp/W+HDkWk1CwA6lnRVl+EHbie4\nClYP3MHH9O5kwb1qEPeox8H/STpbg2TJ8wQOM+Z7vbJQwrj5ukpyaBT+fvGk\n3up80UgiNpdMpQgPKnX88uPZzvFtrBF+jL4HwkyPV6sx7sPBM0xFvUOVXMDv\nrPx6fgyX3ihLh1XAjs6pUEobz62+gHejJ2iI21uYnhUeMylYhXQA5OVCeNU+\nzSDEZzjL+kRoggyTOJuAl21EyW5Yr0IBM1EvTEXe0/6iwMt1j6As0h8knlqM\nynETNfV0yWAQLSsf6zHInMoYKPPudqv3n3mLL20Dgz0MSvLVYfT7J4htu0ud\nzOpgK5NokngdUeFdZZkEiWg8hJbIs2DENmoxRAqo3YDInINu9sfC3MOXM+J2\nG7u4WI7DHVL0gCGHt/I2cJ46UCDI10gkPiH7CSNsjeV+zXT3tziSB7so4WET\n7pkMjDeBPZVSwPb9VRNQpaGkElH+YcSrSBH276QEkigRltiSv0w5YSHpwOKC\nCGqtUTx16KMX2mfk9qOcOg6/7wgzUC2JMsnBuLB8pA9VScnfRQ4kTtuyXKeF\nP8qg\r\n=IT8f\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549591798679_1549591810266_0.9619555361596563"},"_hasShrinkwrap":false},"1.12.2-next.1549671895275":{"name":"puppeteer","version":"1.12.2-next.1549671895275","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"569609636e4dc4c5669ccf605ef0373ae1582781","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549671895275","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-vfjJhWHtAZcouKfANwT2TnFnGy1L7hIHmLndmmfUn/NTbsX6Rntmed4RKnSfxBar/s/zy7OIYfoOvLuDKtdPtA==","shasum":"0e238f06d1344613207aeb9922cb11a2ad6943b2","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549671895275.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcXh3jCRA9TVsSAnZWagAASDkP/0ogCyB8s5p8ryW6a2lp\neY3v4Fa4xIyHY7leJpgQCitsqvG9A3o2IjSeIku+eID8JesULbHgbc7g1vUI\nisA3LQ+Rz2MA054vrdmzg5zQ3pE4dFrkSFD0s5mkumJGie4L4uDZGura8pE2\nISMWdzKFxdY4Dz8wjoIFbxarnuGEH3PFQXXDWfitmDyz96Hd41AcPydKKH/F\nH6TN+10Epfo4F/vqugD1FJPEloVv1AQKndMI2PrUYfUcFrKgc1QZFiqzebNK\nfTVZ+5esCBW8xD2y41lLAxaPy9l5rt94b8XqHJGHasymK3vYE2QRAuxZCuWX\nMmMmONE9Cm6FYf64nMr3O+evk6HqPaZr1P7ToN1+vFgQFG2cgBRVyjnJ0LTq\n1xB8x2p8WiBj4qcUUB5pELFXUx1saVkz5snBOMQAcCqFVEbwhQCAz2aRRIbf\nvjvGELXccqblCiAFOAIWIvlzDI21HdAWQocOLkV00PyxozTnrZhH/+u0PnLP\nqdon0meMH4l4DJ9VbwQBidcjus/fPW+/WEST0+oaieBjdaBE/gktDLhgQqpa\nhlQ5baVMKosJVtIdC+Zz7zq06tDOdzRj3zNG6SAGZYLnSpTFp6omkSKaeCqe\nldW4Lw/Y5CJyfGA96xo9cjX1iDCEfSh6yqz7e06IfeTVj4QugcHS/AIMIGLW\nYwWv\r\n=FzVl\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549671895275_1549671906961_0.03875727808502205"},"_hasShrinkwrap":false},"1.12.2-next.1549675314137":{"name":"puppeteer","version":"1.12.2-next.1549675314137","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"a9875359aa13b6cbfc7502bdddabcffc24d533f2","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549675314137","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-idvfqDGIsLx5U3zFguWqrM+eKaJ+fJS26HQ9C6JEEMuVg1bdGakrraW92S9+vaNYlASX/a1pCZtutISThY0ZkA==","shasum":"489b5545690d81c5446a8d017aa361bdcbf0d996","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549675314137.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcXis+CRA9TVsSAnZWagAApXYQAJdKycuEg6L3CrZVpB+k\n9svj/l0kcWGxKXT7wacTH7Ql+x5AkA71OoIAQiZZqOfaRmG/Eua5nB2/88xc\nVKFXQUSlyVNS8Tipk9+EaRtysnqMFW8gue75Jah9gQPPVUzspEgeuWMK5cy6\n7lSR7M+Fij4jNBNVo5M/u9ZINlDuCfdTDEiptLEbnI5wjrv0V6aKfvuc8jwZ\nZYWidShUkRS+t5EMePQEHo4mM7W4/1z9SC0vqlVUK+3C5/q+z5iK9s33G5lF\nuZIiFKHGMYgYUT3aBM4+5mhI6KV1U8fuHqZ9OrNpQ/hVZqRj3LNZm7JKsh9G\n9RTubkMw0Cz2kwW/sh5mUc1Azl1VALuqdMWFLdjxciwUiC2RAAimogtgJVAe\ng8U1w/haCM3aLjc03zxH6txt9mSNIWdTXLx6fh++YTUggNCitWphP1aShiWQ\nQH23htDXln/SK2xpSId1MXrJtp9GMXSKRQmreGpKEsqBCMRuThpn6Xu0XDgV\nwp6e6Begk5Ev3sxTBhPZJdLoVngIChoPQiLSb6cYqjp+3mIcRkWrb2o+ndmj\n645LYQirLMN0KxofE2j5YA1m6JNmmhrBXCsPCvYt0iXGILp1MChPBeUS8y/N\nQ/396aHuHUNLg/GRGi+ZVjb0PmTWHX02QHet2lv/UMA2HyBXuRphaEjzsK4Y\nGCPG\r\n=rH+a\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549675314137_1549675325980_0.8821376032605384"},"_hasShrinkwrap":false},"1.12.2-next.1549676493651":{"name":"puppeteer","version":"1.12.2-next.1549676493651","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"2a7ed1ada74e9625d8f73eec03dfe560ba978b32","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549676493651","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-a8RBu361cnJNCBTqTpabkcVUxmSNtGl5TMVE5xiY7ktpb521+ZA8jPl2LxbSQQOPjk2OX+56ttzc1o56NWX+UA==","shasum":"efd678c381c8d515a8ef6eda34e3aa0d08fde8f4","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549676493651.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcXi/aCRA9TVsSAnZWagAAKsYP/jFDUAVe+L2Q84wtD4Lk\nT3RR8FnDSb/FQbDOVK32POU+6BR1HQeODmuyf2717m0iMIBfoPufuE7zFRfC\nFHTsB9RsB2nxr+VocbaYtu5AS44Xjvg00kRwMMUHTKIQwQIdre1G9JHKm/Fo\nWA7Sh6LRr2eF5SN0lHm80tFUxHLzVa+dzNV6ooZ082p0JvbNHgNK4mYaQQQ3\nICEVgjxmk9Z6Y58xj0RigdaWtaBVcgKR05YZwgQxzD3zAcZUTapzFiiGMs+N\nHayOXVvBEoiobr6kD7ffpwi9zyOLihTJF2Lyozb6gl3j84XMtS6PMbXK3XPo\ntbibrCkfPhvY7JYLx+2HiZgs1yUCtXAWVwVnMfemmYt+qlZxOILRy1RKKojg\nxZJH7JabsL+NoPy0FnwGJ26r+yRC0Fu7shlF4LIKf5G/P8wptHgMwvXwk/n4\n1xXmPjUKyRt7+ZLop/CDmgFiVyl5Vq2B5FGzU+iiGwC3WKmind8p3E0SgtXm\nmUy19HkuJ/wHwT2dugFn++Cw2PFGe45fYDU1A1ObjTv8ZaeBS5CvUGUAP31c\nXNtF3AnSh/lHARPEXDo4N47QYHM64Uqzxc7wMRq/ywkgA1pJJ5Sov4WKBJCk\n4agFvbLp+9Xn6VKAZifigHlk9Vtrtpxy0jU4n06Q1YSKDFTe+MTwQOfCt4UY\nCQbn\r\n=t3gE\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549676493651_1549676505477_0.7143945502913134"},"_hasShrinkwrap":false},"1.12.2-next.1549681486048":{"name":"puppeteer","version":"1.12.2-next.1549681486048","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"0cf6ab68e78bd99c86d38b99c128ad1cd02be556","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549681486048","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-UvECR7oJZEneyo5v05OQUHAPjj/6qWBDF3bc0JScigx+pDxnkp54YJn6QClVdOWSYDov+g5mVqI1ZKV5/U63RA==","shasum":"525547770a75dcb5ba6d2ad26f44408c56934bdd","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549681486048.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcXkNaCRA9TVsSAnZWagAABzMQAIbKd76x4SIm4/3Geh9Q\nsoQBqieulM8q8cmPiH7rR2SVhQcnoVJ/0B+OCAsoKuQCr38mwhNivj2bQxGo\n3khVRu8sUhYJs+WEFjgblI7RtX7IsFp8b8fVaHu1xEyF/8+Ie4ld1xc1kgY3\npCZOrxR1ViYaBR+DaVZZEIWG32a+orawb4itsealdx77Wkwgdy04A6lFhH/y\nJLRu5LnD5gy5U55bJg6sU9XYqIY8qqyI2vfKmLBtfX3q6czT4SMgyhM+IHNG\nFmOZ2ZMku5HduhBEGjtUOLOXFV8n6wjWq1FQ4AXBDLbFiC8GLy+nKxFiZynb\nM6KitsSUfcy04RdEKlM55dxemtfHudqvQGNnE6Oi8qBLuB5eRCUQSq9tRZxG\nQbXGVxhZkjijtxgYUrWT59+LruDpOGNbWlKM4UrFgTwQGfi/dNXVST/KG+cH\ngf0ZLU18O/ybrq+3zsCLISIoJmN+g8uf0OP4EKF0mcWLqVeyUqf6mOpCo5ZA\nRv6IlW9fRylESvYqxM5cOHwXg7kJZ4pU+T3NzfBQPQIo+BpQ5ibOP9O58mbC\nH2PjZOEyQ08rhNu90WSz2y+sJNn3rEohMBZ+p1MmAUbz4G7tSNUVV5tGnfgS\n0DMwdO2QE0nbREFseIOAO7Uo4PHSajlo11fDP8sCz+p3rdtTul6Q0YU9opwa\ntrTt\r\n=/sIu\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549681486048_1549681497778_0.20295652033164546"},"_hasShrinkwrap":false},"1.12.2-next.1549683034841":{"name":"puppeteer","version":"1.12.2-next.1549683034841","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"1ce578b7871b17a9d13db43325915e007049f93c","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549683034841","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-/aUUHVCzKuKUoqv0qTE+iEIlp33wkrWVbOnDgXBMNWcix/MgsLDVDb+83zq9W+n/cyOVlIMvcrlvSbw9BzNk3w==","shasum":"1110beda972a82739e56d3b6c88098e208f69c4a","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549683034841.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcXklnCRA9TVsSAnZWagAARZoP/RnuAa0/ZLvQg6bLer8w\nCpNj9ovKqVeGi4mYJxInW8hyEGTKXyAW23mKqZ9jntEu04HT0xGJAuVfqlKK\n/Ds7Yk4m+KWorAtQHULee47zsddkLhpZkk7+qUiKf+VrHkBdNBwbAgEQpaA5\nsov94Li1lvSG+iGUGtcaatIMnrwRCPv0kIWaG6QdXehixVKkc0Thq1Q16Vhx\nzqaRC38OX4HjfQ6izTI8l5/XBd3UQHFBF8bmWNLbXsz9B/q0v7M1FwWM0TDN\n+/2K6vWIDkiaagKf9NC2rYl1rKJkefRpmczjmit0ELF7B7dRcInj/1Xe560b\nQzJzq6t8qR4BMH6nUQcyuv9fn/cEgVdQ4UEN14y7ADKOAAHbmg/Vnq8TFUt7\nVvWp1eTnfQUgBRtAYFuQaQ1Fo22cjiy1XWeldFg0nN6WkmQ4Km/LVSihSBBT\n7mi2gnpSE7YTUgWOblr6oUrgxGMo/U39WkquzfqNCUYNF0n/9SPpCuHgW7sw\nTMsYNCV3qT0iIO+KEF86AoaQhwjuoJMltNVP6tS2bjocVVrUF1WtJIjrBIc4\npv5dq5NiTJDTwpZfBOh5dFHWqCu4hTcg8ka6h51Rtic+MeU9gSBCBFAZHrcc\nhMqe6DLbq3l+M1R/+j7Hx0yVTuIeUTF+gkzWIgUi3SSrzdvwV2h/xfzhef/q\nXOsx\r\n=k6U1\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549683034841_1549683046472_0.4891644874879424"},"_hasShrinkwrap":false},"1.12.2-next.1549684766090":{"name":"puppeteer","version":"1.12.2-next.1549684766090","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"fc18a79e993c50ed9b1c674ad72344f148c5bacf","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549684766090","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-HJeJmZX3R7MKC6W7FK7wdjSY6wfbag4CkFUfDZb+2DaisM09FeQqoYdxTkf4IFFRMxe6FAFTkVFQxX4zkIEoFQ==","shasum":"7f7ef58de2be4894def1372bfaf257b8783e5995","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549684766090.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcXlAqCRA9TVsSAnZWagAAuXwP/jn78MEnMHJ/MM20Y2JT\n6jUAKhl4vZg6hBo7ZerXKcSrZDTM5bPZhR2rqbZvkHl05iIKGnHtyguQh8Rx\nDbgUAMtyI1fyNxisBM3i/w8ZfUmZoXQ3si1Ews/awXquM59eYq9V1769Kt/R\n4R7LXw1UrG2Q594Z9tBX1SS2xwIh93S4M35CTvFfhYESbfnUXjzzgxrSsChP\nfU5ta2qlTvZ/5h7aa9dWx9paRuXIyEKU2GSJCj0TzAM2efoehfHUFgnQqc4n\n4l95oWgV0Gw89K3fSQW2d3ykiBsSNH7+mCrYNhtGn/QRo0X3xxFEnJjv8avR\nV1ZHq7sDTAhxh1FYJmHCxmiFuHon4Ra6Zz9Wcrp+mVqE+711k70hXCY4AnDm\n7nZY5pKWgzIvTEwp6KDt9d1DwNg4ae6wGkKZpOtZixBKuyTrbhdNR+TBK5G+\niNwQryXDgL4RJIK/28FXaIVyTitH+NTTTWmscAG7S0exEBnXHEpYuqpKw4Jg\nzB8GIGdSiD72FxjMTJhYdBwgc/Ki+rQ26e33PHlISNnHChSTuPpPwwL6L5P/\nHKZxcFqHAnq9EDFXdaaWqX/crHVgjsV7eEik9cIE4+6II4RVc0m8WCL7xxSi\nsDFVmqkpYvsyukCTWa6O5NeeOp8XHRB6yONcGFwoPThVPLW6pW/HnopnorNE\nlxcK\r\n=S19P\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549684766090_1549684777343_0.005003010247911277"},"_hasShrinkwrap":false},"1.12.2-next.1549687399259":{"name":"puppeteer","version":"1.12.2-next.1549687399259","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"edb6f62824b0406df2ac383fa6836c74746ea11d","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549687399259","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-kWbtjn9wxUjz2dM380f+x15CUkHnKIEXGNTFY7ClnoNnubVkNrT2r5qf0DITceSS1JgnC+GBoF2f8Kq9EiRrCg==","shasum":"6137becca1d3e4b45e8282d55486de6d7b2d0de5","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549687399259.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcXlpzCRA9TVsSAnZWagAAQuwP/0EVR/rOPQy0ZFFFKWgb\nXKsgVoGogZoTJu4avsTzgbzUZf8qfwXyX/SxJfB6CZepMJwf1ioGSIX9k5kP\n1NnPJXHh08dadssPG3cvepNeVrTN5Fvmpu90hadqb7ONnrtVJ2TaNNLNkWmG\nytVfAOyjHuiNoDVE825rAgorR5aan9G7rK/9z21Hlfwox/i2HVxxgOkT1Iwk\njzF1yXfffgT1Oav407UagxumKvZ4iIx+4ibSlWxdXpzxGLkCLkq5SMXT33kE\nmb766XO0JcQU2kFGgxve+BBkkETDnmwULMyWcunRkHj9yukTdVEpdMKRB0a6\nHRxk/wa3yPhutXFIXKgdZs6jrn0+HH8jMWzYRv7wsEBADHODhYiREEr2Jta+\nUVX1WJm2GduI1AJsgt1k1J4ub4MYoIsxmEzB1gDt/e2UZ2VcKawGhJwqXtMs\nRqIJmkr4e953XbaRYDMXXGI7fwSW9W6Ls/cw+xnvN91GcyCaiz8MjVfAYI2M\nR5uB2KlCAkm8SLWd/x7qcsQtgm4oTOpy0jjGJSd19lYRI1vG2h+V8XodGDfM\nXVXja9cHXYH0DWTpUF9iXm94WawsVD1gYEysOUX0OHnA12MJkVY+UDFP7Wc4\nrRB4uMIDINVWWBNjv/Cejz3w18oWXaDl6Br9yLXkatn6T0iP81WEc32+76WL\n3EZa\r\n=NtPc\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549687399259_1549687410985_0.8587710391588721"},"_hasShrinkwrap":false},"1.12.2-next.1549688623724":{"name":"puppeteer","version":"1.12.2-next.1549688623724","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"624492"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"b82cc150d13aec1864e314a8586f814cef784834","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549688623724","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-4jqHw6uaCPy/yDwLUTrAhji0laJwkOEuw6Egam0wOMwJ1m/6q+3UB2gYE/Y3jfIZ/8YE5Fzy/Aegh3kF2mrYhw==","shasum":"d7a9a62e1d9cce7f705bab47d0292cdc2ff674ef","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549688623724.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcXl88CRA9TVsSAnZWagAA5lcP/2LoeL4+sOQQuKbQOGDS\nsZv6Rvn6QjcWpSJqNouTuRiyc6J7nXZ69V42tkrlamesjfs1Ll6JIf7LPCCy\nRFZOPuH2QW5uI4ite/szPqChglwpibncUTNMhSRqp+bMFYLnuA+16ynT7UHa\nLXVFJtdU1IEjhTYC/qqUkYGHVIiko4ILATNcohTcRAPRIokPDThRk6vlSnUh\n2MaHpQA2yRP8ScgevVaSvjuPR3GSmUV7/8LErCqOBNypaujzo5r5guVOibiw\nuJItM061pe6bSJ32LWsnyj9q2oho1LxUA763Zy2wUUi5zEf4Jowj56jv4XnD\nf4tSFiWDqTFPtD/NvjYpXV9DzXXw1B3OhcvJ+odffi6IPi/9p3H3qg+Jx9Cy\n8Kj4rNMOJ0zg+lrK6ge0t2epckoXvVR0VexL63nH/MWnvIuLB5KvNm5QnW2v\nSbLE3YO0cz/2hnmOql6/prNqvVC/wV/0uBGuocdEFYuGf/sZ06l9EnlpqoIX\n+BQPbTYcVuGkQhZgx8utEjk2hv9iARMVuY4TlHHYkssXPTUa18TyCosKwqjn\nCdIj289uuAWfrkyxQ7yJoW3E3yEvwVQvH4wLCR8/ea0MSkhXF9Hg0U4O3akh\nfWVvSnXqSwbVLOdjoo2oDAcOKw4Qpl2Ac2na3ZbhiY3d+NcacBqPzDGbiPgS\n00Vm\r\n=j2d/\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549688623724_1549688635363_0.46197399840885045"},"_hasShrinkwrap":false},"1.12.2-next.1549922885721":{"name":"puppeteer","version":"1.12.2-next.1549922885721","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"fb9d4049d82d2eb2ea6e91874867ecc7064933a9","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1549922885721","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-iGXzgorgPs7yhR66QmybIlTIY4uKnTILoa2tY8rH2CCb/g9O5srmEsUsiHeXq8Bm8mNZzca//uBlgN1tjpeFew==","shasum":"b2886226ff46701e2327509145bf8751cadf8753","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1549922885721.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcYfJSCRA9TVsSAnZWagAAKIcP/2emoI9hbGrzoIx1++KX\n7Cxndo5Bgbt/uiioEi8kjnNk4N/futwOcsEmDoanOS4o3JMT8Sn07aaGNqPr\nQe529AKKtlwZ2pQ1P/emsUAsbqsm2mf1dH4BD5OL4gFiA+kblZmtPooyGxtf\nXjE1/6oKR7f5e1Z1Nl1pLvF+NCYgf2Sgadq9TwzfUthwDOeW6eKxZiBIb02R\ncA5TK5rsvYAD8RAh21NI9jo/ToKGylYFczrZApIM9Fru6Ol5yxdNlBxAWaJm\nq4UlGkHObQNnsKmxcrKv9IRckhS1V4Aak9VPTZR1o20tUPFvr6ML5VPtP9Fe\nXeBYJxws7QJq/0lbvzv+v4KEskyo+6vamAEAn66pQCEzC11zTUGF9nZUPGWb\n6qG+Xbg2o/EmdLqUxEWZ+29PJxo1HvPZNzwXBxdc+NptoV/mJLkam2PeVDiN\nyhmprDZFnABHIOsipPU6Q+nPvPdNKBAGTaBDvXDXVuHyihamYD8nB8XwLgWx\nA64BggABOrhtm5MM7XaRruGtq95IVz5zV8HF5poAO67g+4Wma3qHawFyaRC5\nmw5EcIjkK+UHFhqO/II9vWltBOhdPcktr45Y4gUSTxIcqGH51szZOI3Leir4\nokdaKuL6xUgTqy4DD4Cl6P/W4xyeZ5PXXuLi/EI8uPRF6XEXhcN2ytOF3yo9\n0a+J\r\n=D2ip\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1549922885721_1549922897243_0.875628934824328"},"_hasShrinkwrap":false},"1.12.2-next.1550022326412":{"name":"puppeteer","version":"1.12.2-next.1550022326412","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"afb9355b1597a210f1c42035ee9a37656325fa59","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550022326412","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-rEB+6trBKIiSNb03NJ4RRbqPO2OUUzAzrAh30OVcl+1DxVBJi1jRPkJ7XJ3kGwRMPyl++EgDwaAiCh8Yh2yRJg==","shasum":"7b469817adf02b17ba885c09a1776bb2dfaea301","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550022326412.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcY3bDCRA9TVsSAnZWagAApXEQAJMZoJ9haEFlz3YI2L60\n3c2fcbwNj8yRpNPcnn7X/g6iCPDKNOcvhv65xkm0kiTFKQ8Dhm4e+lJxhx75\nTBmmpSGSL46ka3vESWWvSBmMu/QUaqZaMFHkl2ywgWObgAO8CtjFobj32mrN\nctlPQbgTfozqEqRPfrsJfae3TJUhVEHnqrH9gu3oL2caci+NGCHDxbaEAfxS\n7+Nx2dLqDxNi9pg3TcnIKgalzNIC/BjHFKb2smuXUjo5fdjrXr1bESJQ+ELB\nLLCqetm6dEYZfdSjF5FHj+hCOySoV9ltgtWfxLdoTN+9tTPBgIWHffIUq9xr\nMMnPkC7V59OlmBYrRK8vVUBByVZHlWRNBIMk2ukk9fUDgY6DBGIV0FEfTKFR\nRzMWBAEig0m3eTc8wuUVFEmyDTnh2OEOKEbfhZsBFk+fTL8MeX0fNhafPV0i\n/YFHs8Ul5PswpogH/UnfhAj4DoP7RVzRvaYtkJyIDP1j8Na84gTbcGFEAq1y\nIDahjD0AXyKb8Qw53xtr1tpn66aHKCWuUuBa/jJM3O0mXyr/nbil49UaipJM\nNh9rJfMFhIkp2Qvobce0q/w1QChgh5VEkcE4pS0Ahm3UnCkwNZr8X19MSKy5\nrO3aMIqNn5VHrH7giAaL4QR7XKotUMDlRfM24zl1Pg/LD+s5RWPhyBOi9u0U\n6cr8\r\n=oUng\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550022326412_1550022338250_0.8491709496256923"},"_hasShrinkwrap":false},"1.12.2-next.1550027809091":{"name":"puppeteer","version":"1.12.2-next.1550027809091","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"1890dc04ba8c86a5c636c34f7d75222ea7a1c6ac","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550027809091","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-+phZ3VzIqMi0sUM3/ots7IvaiGskd/H5LcuJBkR/2HIYfEdZwNP2dEuD7Qfy1T2gSnmKXvTX7eAcX87oVfCVJA==","shasum":"d37c9905be92c91305249cd2a678c9ce351a4614","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550027809091.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcY4wuCRA9TVsSAnZWagAAWdgP/11B8/rEjtmlbDVwWHJy\n3PBsK0IWEWbNg2Ee9yd+zWvu++2FPC/T/VkPHeVHrOKaMJAh5PlKhfwTg+Gc\nQzhJwV7BAqNnXXcaVdX6QdJNXEmVXTkkxRKVZDMvoEAyP7b3Yp7ox9HFfViD\nyx/QFxQFqvPcYtdPk30sA1t+qIBNPC3jCrUcbgPa3KDbfq69B+d9ImOjFj32\n8RpQcMx36yjhgjpjHqSxEiLgh6LQQrfMIaBLYEdphGLDGiqdQ/sAtmiyIgHs\n3Qj0J5gQQ/xpi/rs8qUal2jn4H5UwLra/VSzAGdkmmRsRyIcQP5TW1iKEQ/5\no+nJ9ufagjcA53VjIwLB8FPWiaOWy2YDcN5ZZBBjaBEx/3zZm62ojmWLh8FY\nzPMF0WglHXUKg28GrDu4FyqSAHCMOIspGFUuUTtLyAP0U1xQuT0Pfl9BeI90\nHcZbI8XfGvMOInLBEoHgfpQL31m9hX3l1Xm7dBrcDhPM/AD6XUAYFywUzpAm\nKnECGLH0fyP2+SZepZB4lyiZzv2pIHhHCpB0ZZFO+seW4dtOSsZ71WuqKtZf\nXiUex8Ivs1OvUnTSpk0wReAzCYPPICNrpAtgHDg1YUfXHUsFDroGyw7zJkkY\n48LFPl52VCm5w972GXWVXAwhVRiDXSpuVK0SNlM0bO1BvDVBDhtRMXwIo5yZ\nkdMj\r\n=PVCp\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550027809091_1550027821196_0.7000998697139686"},"_hasShrinkwrap":false},"1.12.2-next.1550030782241":{"name":"puppeteer","version":"1.12.2-next.1550030782241","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"f0fba56ea32ff1faedf8aca4ab73e700f0bab20b","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550030782241","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-hcqlTIst1WLaPwE5PjZyZMIllLb19QtFFlm3H2B+zMF0fEstXrIt+CUFVDXEyWT2LXZSifNRammx1hbmQwanzg==","shasum":"0ddb348f09962de2c43861baa7ba29c5db0ecaa1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550030782241.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcY5fKCRA9TVsSAnZWagAAmwQP/jtD1J2Z+RxxbB8XFypC\nRpm0LngUBBezisj36Y3Et9S/MrteQdgDPJFS4sz7AOtIkYfngWzYKhlvENxx\n8JJDIo3OtehnRCP2bZ74HZCUIS1vQ4MTQbAtDVk62Ldl/Kq/ps0Ggn1rcKt8\nTACrSubNe5s58gov+ik02e82CJKny/lyLIANlExs3l+oJEtR+obP6ksW/mcQ\nvpVZKGISpjC3ssR28E0xvuc4j+T0zk0VHGghRAwSyDAyBbOE+HbggOf4Ju5Z\nQEo1xcz2DxGnXHjsWvaj+0BaN7HYGxuvz7wt0keKyUFSonGBC1tSJJz9nshQ\nHqnIyr3Si6s/HW1r/zaNlXXx4InHJvo+wfBAae/WNZFT8kRixAR+LZUHsEg/\nIYuJrXXtr2Q05WoyvFYmg10kxwCO2nccyBw8whxrKrtuMxKWOhlYuCrLLdoE\nyzfnaSwZfD4fJJZWjbeQ1EKfluIg2xh3MM/uwm2KI6BocMV/f7HqqOHDPh7l\nQFjwz8hJLmS9jz0MjPMkDrOY/5sUpzsWpg9WS+jmDUXrqrrOAJDqLARCd7cB\nSse4ppv8ZAJWM5A/J+DdlJKMP5LypWL9/imDgG4ABAZlo+GxzEZeZV0MXyw4\nV8/bi29BC+Iz0dhVOVFg3Hhbc+aNvyt/+VlELxLOdjFxPOXr7XNbquDofeV/\nmb5w\r\n=oqDl\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550030782241_1550030794286_0.17921173469335816"},"_hasShrinkwrap":false},"1.12.2-next.1550031427756":{"name":"puppeteer","version":"1.12.2-next.1550031427756","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"89d0f1e1e7dc97e54b9180fe624e7e4748fdc100","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550031427756","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-1/IEF+fkd+CW8sryv5rnfo88iPejEhPSxIBw+foU8vngrA6Gm5zOXftg6CST+/XX1E8XpFyvIwV5SMGyIjOGIg==","shasum":"f54de6a12d5d48f40e4a82e8a9c1114dde8dc2b5","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550031427756.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcY5pQCRA9TVsSAnZWagAAojUP/2JboAMlT2g+43xF7Ozw\n9ATMkmJR6HjJjisa3FBwt7WQNktOEsYgj+au8eYUp90cZJJdUUcLWb+YZIMV\nAVK6k2wfcA/YNKd8uydMjhaVc2ZMU8VDg7TqBHmpy425+FElo/DZm1AMHTrC\nZ/0fD8LC5WhlVPKrZcq2Y3pjVjnJlVO24g1YzR8m8Ki4je0uMqhKOOy/q+A2\n/qyQt9s0Khs0FYoeiXMT6kaDBLI0vDjqW2dPHPez85qK+OuvLbwHV4zievoi\nqGe0J3OBHE0ZB9gHJ2Lcv+n5Eq/EGE7QR8zVM2/I9Y3t1nn1emAPxN85MuNl\n9KAnxqHreKoip2juQG3E+T+Ghf5UDA50ERxldUvkkkMLd5DRNKNnWrvltCDq\ng9HOsTA3Eyh9+GWi2wtmnraJSTeNl18tME/Y9Zn7hQQSmiOHX5OIUJxTTiSi\nOJyFn3bCFoV5/3ARqyvqnET5zKSpU+BPXFzA+BKQhX4jhQRIgR4UgXOkEmTz\nObq1FieDHg14QxUd1qoSRwyBf//Qmq/gGXuetPx8Nam56eNZBbKJHr2fx6dR\nZtzngBsZ8P8E3Z1rA0cg4OBdbhUKJ9ru0R6+Unxo/Nm+nboDWJMDwrWA68Ip\nUHJEWQ6GJs1ZAGxpb+R96eDNcgifryEK4ZZIfZ0k+94LD3/Yzkfjm+dn53+R\njLc3\r\n=8iwh\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550031427756_1550031439540_0.4506996191536563"},"_hasShrinkwrap":false},"1.12.2-next.1550048628025":{"name":"puppeteer","version":"1.12.2-next.1550048628025","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"31ae1d6d150ebcba0c263a2565d8a1bbc418e396","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550048628025","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-A5yuCY4QTSSo6siBq3QuqcisN6MIPvdZDbT4XaJ/WsG4gdtB4PsOuEbl7C7hdgeatrJAZiLSG8BtqF7KElqsVA==","shasum":"540b0c13323666c1f0fb0f7bdaf7650b43d2eef2","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550048628025.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcY92DCRA9TVsSAnZWagAAyfIQAInAJyTS0RIORQlmjm/l\nYj6TVcTxczLzTME0d0d49p5XawAZgse/krxxWszj7FEBkpLuazqGhr/t+Upq\nrXd1bjJspwKV9fUad/PGeb+ymAlUmU5XYWxMaPHMRrIHHo9pfzAqlU8HOR2Y\nAk3RQXO4pSNLNAw0tesCXuHeWYYKP5btyOZaJIsI67SPZqv0NCSLneYfQdqn\nIRo5l4gwBMMu69WfXI4fXaVEbmJclM95bI819JmOyNS7isPZ77XxvIi5QcvB\ncf94WbZXs34ODbp+6fpnDXKp7VrFrP0Dn1MFgvfBmrL7858P9SeizsrcGeZH\nEUqHMOFMAY4vqpJ4SIoy6JNsO6wmgYonGIfVzlGw6ItaFh9TSxFUiGV1l100\nV2osUZgusduLEq1yT3QeCIqnmvKKqdteSAGBvT0U+sbaRzpycAovUXdqV9IV\n0VqYK9Lyl3KDZe/J6HVKUz6K9vstuIIxf+Zlut8ygitbrZftTeJy4JuCbbD/\nInjhmON61ZCeF8dAp48cmfOC+Iv0XRobtR9iZMfXDRpU7SPnI3gjRtpQXL3w\nGSUz0+oBd1S07v1j0B15saQKr/eu7exnjPju2MT6NUyWK6a/e50MsvNx1wC3\n/d23KHQF2qolVCz68BUmncZUm7EHJ4emGiqCjJF2VffUCv07XkEimZqcJP7d\n8pCL\r\n=+HM2\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550048628025_1550048642100_0.7065518209970185"},"_hasShrinkwrap":false},"1.12.2-next.1550086939093":{"name":"puppeteer","version":"1.12.2-next.1550086939093","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"57e7f12fbc89e7d8151b72a5548eb361debbd582","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550086939093","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-eSKe3btTOu4495B3r1Vq6gIVqeoyyLMM+GwvKy3w6Jd99XZOlSfs87hFZagQwzkt/aRrmzcoObZ7E3jzEeyhtA==","shasum":"97fded92e8148da6a41ad132e37b53b925ca155d","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550086939093.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcZHMoCRA9TVsSAnZWagAAI6EP/iwOX1zyKfAsR5YW+gs7\nwdwBFtM+rbdPLk3BcydC8kwxasDAKIVxfRXGeng64iE3jRPSJUz4HNUd+1B3\nUmhxuKa2NwZ87ChNhV8dUHSP0InYACxsviZENJyVAfuUjOyMXYkW9+ugtWy8\nzo2EoYp8e7dBWrNecLtYj/Si0KcyMNnjbqWTNQndyWQOnrWDlZcpcYm38D64\nZZpEMOYvDSmpjFFJcpbAWTz4Yyhj4eeRYfaecLMZs7TMnJr/Ou17Kc3D93a0\ntEwRFJzCbh8LGCAipA56wiKgCut4sBSQTh/oIGBSCH9zXHA5ryz4RlX9y014\nZH037ZK2drZ0PBgzhlg7VCb7zyxCvlbw+bBdbzQ90YCmJk0tGLLmLXRdUJ4k\nnXYRfZoWROFbo0r+CgTXKA+o4QL9+IUD55cGbNj0Oh0wORMRSA8lxuO81yWD\n325KmBJ/2VBr3lHPb1tXhkSBUZjYXFOKb+6g/qjn37mbhdyk2fArWA0g6sze\njBz8H4fqrGW6ejkulLwd0YR7JXtZxJZDj+4793WoTybugumrCLVAIfJz5dDy\nVyPjz/FoXMYlq3mRR2ZDUC00j7dDijsDIAYEdkZR0IG28CZibNaWEdl/DCtS\nJnAd19pSu3lcxWPrXvE8QJLpEgNFoxyjY35SE+eU5NxNpTgbAw9A0XIjhgzP\nzzLm\r\n=oX0V\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550086939093_1550086951687_0.22491433284618068"},"_hasShrinkwrap":false},"1.12.2-next.1550088214550":{"name":"puppeteer","version":"1.12.2-next.1550088214550","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"13224a761ece560124ad630b85bf0e5151fa3759","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550088214550","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-2lN1+FxrUJuKTX/SrAOHQdo9+tpQtu2INSSzcTGotk8Mkom9EzxaUjDYKu6pGGqzE0FnXpb0i8rzyyTJNpsHWw==","shasum":"e3cdf102b6f52b7fb4a3e846714882b53f319634","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550088214550.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcZHgkCRA9TVsSAnZWagAAkiUP/25nBWylaLIeLGBkVGPK\nCXI9CuDIYekmyKt4tEIaUHCnvBNvL46+C5CiWIijoEfqrnudTcBmnvUxoyTB\n7/5HLv9N5os4dYIh+CMgyKro85aAKze+jMpmUy1s86G73yxQ45MsvDjo0gMD\nwsCHJLoUDA91yJfPfSgaxyzqa3tSvYGQR4buQPBAgsU3k/maKXWrU1vFRMU8\nRImsiY7ihTNHfEwU7rE3L9wM86YFATu7AyqZNs1oXC3mpbFKR3Ap5TnzadDC\n4iKB6lKNFGMNBFz4qkLDpQi7izUlqFGu8vQiqXxlC3VdSs62o1yKeGOM4duS\nJckXTMat6jmDCrf4PMaMAe/rRvKBI0QWtkyV7sLjVNHZakALtpUbo2G8BrQw\ne05QmWvqJ24SzF/RwSuCfhHeLBIY7YVosgbBosuu9hg48q5Oc0FHd3y+hIyB\nRSJCVqX7ehtS/f+pOc4/A54iGqzzcDh3rwnR5Ib4PJSbhEe93CXlRwQwZ2TS\nHpA9/KPf9sU9v+fSDJVNkFUg40JVpWbvrNoXPHh9rei90LEpr1LXbNpzJaCs\nszCNhVkDYP7+xllm7KKKPx5h6+WJ0niblp2fKeoZTSQTmkm+wzFayhP6uqDw\nzB/uH1sc49SiecPfNPDVuiw0G8wZfWSvlZESfIxaI0oRh12YrBf8ChVljH8m\nlXfD\r\n=VPL0\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550088214550_1550088228232_0.3944730356127759"},"_hasShrinkwrap":false},"1.12.2-next.1550092693872":{"name":"puppeteer","version":"1.12.2-next.1550092693872","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"fbf36438e8502ef37b4be2819afa67a595410d68","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550092693872","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-DHArhnF+ZTzXEBR+63wyTGhvHSkLxVrc1b24ERPRenEReZaH56w8t3uDqkAZwv5hlWeZ5UnsQkxTAm4A7gH+OQ==","shasum":"2dedd78dc2e1c673a30f7471768fd4b50b8ac5fb","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550092693872.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcZImiCRA9TVsSAnZWagAAtdUQAIMiX+1wA5wyF7K1tDRj\nEo7hpu0z39hbRU6DNzLumGCyNEu9RE4TOn3MhpVkc++W6qY2pCO3rXixbQBf\n/WT+q4CLVy+epU/vbytxkQbmfuxozZP3+LkKnMs+Stnm/bUw9pX+0CtDu+2f\nUPfGDxekjNgneLgiXT5E7VtenlSW4mNMsgNOLfR3FMd7Cc4dESyCvRXnykTk\ncJ8FjWmn4l8Pk/ZxtePCwMOvOUdhpvoV1zpawUJkZ5Oh2BDFwsV8u0gf8sw5\nWXPjTq0DkcsGw5JLGHvo/HzzfgxlHsxhjYXrVTUkp7zEveArcIGuBQRvztos\nPH6rhSpBHuBdyFGA0CI43TTWypAk2E/cgrf0y7ZR4DO86lq5tPvjILtPooQV\nbtKhUH7dqfmx+nUU1+JZD9vzaLyxiSmxJ+Wg0Z9F1g6C3d61Y2XWtGWSfUpl\nUPetpwClEK5pcr9HTxzbvqXh0ghn0RpJGuq0e9T27XcSdRaIgxtgEhAcNWCz\nUte/Sw9YaLd2V65PmK4sXTXY8M+9n2Ox+x4BOln7qRwQPX6GeYlJVDRPAlLr\n3mgLQvZ5Dzcj3v14FjyoLFAgblQOgMX2nL8JvjoObMOvUGHA/tFdgcAcDfQC\n9DssasCwGoHPYzlLHXKbP71XbCKOd9Qkydqd6xh92DRKDKtNVpVQahSBOSsy\n/Doc\r\n=jjsz\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550092693872_1550092705457_0.3020747213869761"},"_hasShrinkwrap":false},"1.12.2-next.1550095102698":{"name":"puppeteer","version":"1.12.2-next.1550095102698","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"670d758dfe526baed8f4fef946c5b61450d95430","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550095102698","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-QAMHA8NQ3DQT1PdDUfticpyZaCPyq+1iWdNS2AK1YsBTI6b7TdACyj/Lif4bc+Kf5FXzUPqgXP35fAma7Ebhvg==","shasum":"cb676491ffe9cacd457d5a4e416c37336affdbdb","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550095102698.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcZJMLCRA9TVsSAnZWagAAiMIP/1QfKe3JGmzeu1FUE+WW\nPUzMvGR/9xzVtoHR+ZuCJ1qouFwV3ThW+XkIaAYvyRkmxqNqe9aJxwXN+0Oz\nbRsoZA0wbrwOx2AvOcS0iptiCZ46xqFgh/0136xG+NFgkx9ljyXdWhnkB6hP\nPwHx7MEOmtMU+jP2+9g/AO0b74CckyFG7kHL5TaLxaWdp/3+1nsXbsl6JxOk\nBDqAdnHWOS09rJGN2gaLlQOLVzXPUtozxScppVjWoG1pI0LgY2y7b9IKpePr\nsavltX40sv1pj1BGF5vvDZYkOe3pNjpaauzoTMAS4WDenglvnGEZj1ZOsNNn\nb7SLX53UxeKPbMmgWKkgwUqKjilAUS/bMEHN1a0w4PIOMZHQVPfMKTrB+yNr\nwdw0mN9FKAVSLUB7dMxHVtz4rwmypwwCz7JWIXwgUb+23ZxPzDveKjgKjzR1\ngjMeJzPYzmMqW18R1D+K6VUYFLZMAcOMW0GR8xX3Ut8LbHgpTVesNXcsMqO7\nSLbKFhcbdoy+18vJy2ToJLy2Wh/HhY435QQpgOOXkDNeRXXUuXkVdAZnmtqx\nsUEc+mIxCYM/oCuQtdbH+a/ybxqKSLXy0o93QZANwQLNuScM0VY71yP9te04\nVmiTWtROrwwfUo/YvEBFDwsYMTY4fPfnSMdu8CAjch45LpbimKVUt86aGnHQ\nh+wC\r\n=XOwM\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550095102698_1550095115028_0.23420445123299816"},"_hasShrinkwrap":false},"1.12.2-next.1550116409786":{"name":"puppeteer","version":"1.12.2-next.1550116409786","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"2275c3c0c801d42514d6de127b9b1537d20356a9","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550116409786","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-Qkg7dqVs1YmHLcCiV38arJQDAmFjI14c8UFVwEBjNZHGr5xVnR4fzLvGB45Cmlsg95MJbL5l3wQTNTtBbjYG2w==","shasum":"0e1b4a0286bead2c15cf94b96886401c871d18b9","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550116409786.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcZOZHCRA9TVsSAnZWagAARmIP/3frMA83eGK9QBSL85g+\nyxIHMvoQGZxwC7Abxh/hO1U/AD9VbLdBQ+jCbZDNTphTMrnvTcxt2Y3ZwxI7\nIgxyV1qN0G8SYLJ/9sNUO7h6DYjXADVh/Hg0/MPcU2Oaca0cSyRh06REEKOC\nuADMZo6G8xjGAaBe3Yhc3xLtDoiL3zcdPzmD0BJbPlELkTpo66+8IdLjZ0+X\nkvH4pMjcwmpDBNrfWZeUXLcszmFMh1ygGIehQRIKQ3eSCRM0/bGg7e9j01gl\n5mfAuCEFkICckhCYHDIGI+bH+prG+hZBIf7Kx0i+l2aPH5VNqJPn+2hFSkPw\nmWRzxpC5yddhd+LG/5Xl3q3pebGmSmp8qknc6S4AVF9L5a1/tMPNtx318STZ\n+VsGRnkXFytjVPhl6uuuB8rbpWRVsTU1oHGQ+QzGilULiQ1n0LEI9aP3QUhT\nNhLvFitOpVx0InxVzV6z288eoIQw64eFhydXS9hojNQGo74f3W629LnHLltb\nh5KsKejRnb9h6cTi7a/2qFWYwBCqPg5smVEmGmB1n3Kmh5gkcLApD5C0hjsG\nCXn4mr+gRthXdub+CUXdC+jnjoMQ6CSWBar/u7GfG8A5UGQS+/gK8izItAKs\nJ1MUxHACV2gK1/nF2/67OZp5SNghJlEkZm/ym38uLdGgEOv6yULFtj0pIKRE\nxhP9\r\n=SylU\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550116409786_1550116422331_0.8675721793357558"},"_hasShrinkwrap":false},"1.12.2-next.1550116996244":{"name":"puppeteer","version":"1.12.2-next.1550116996244","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"e3b76b2beb1e44ed61ad88fceb73c0dfd8f208ec","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550116996244","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-n64jvlJfPvNoFKLrI8KmHlW48PE/gkPG4nnK85tNBuVaKUKliY7RZC/dmAetvr2YT3FzedAL3s1Ge+ZFUg93qQ==","shasum":"d9b86eada137401f314351dbc16a6c1058dced6f","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550116996244.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcZOiQCRA9TVsSAnZWagAAd8kP/0SF031TPHi3qQKThULv\nKDedxEIBSAPak9aD1CqobL7+OHTV7TzzJKDeVKDHKwTm2KAgCrbTX/eN7DwU\njjsq/7jt88K33++oaIOdjmN9OC+qYPaF2/K3p1R+2vqCtwQApqXSBelasb+M\nAob4mLQgjH47VOcYcDRWghtimZ+cNFDye0JpmbsX9ng0WMgY/S1e5knaw/+g\n5CSb5jHa9BLbdAFnPzKJFdmA6P0Oy1sOS0UU8vnxvbUlCaRsJkXapAAdgwWK\nVDq9U76VIo6dgznlA57pr5QDkNaK+0TgkcdqnAec2lqBIFqmXESslqjLsdW/\nNC2BOPMN01uL6cZI9XL/dQkPJegol1BL21QM6EOkIGtzf6tlNucoXdZSke8E\n5i5Dsg4cDpZkkXEk7R2GkFHxtWBTIaWfgW3VQm1OeUZAZkk9iEOFKXGpo7Rp\nV6Nzkxfad4e6sbMu5sxT86vf1A8qnfiOLsg0hzIbNobykxd2T9dLbd7Nq/Vf\nqk/PYPqPxuOnqK1adqk/NyBKBfOCGWWGo/ReUfah3bZRkpf1tQMtvzQBQUsf\nJ79iFymQCHYNHkeyY0VgJTUJLCJMvqSS3CKN8kx+lF6B23Sw7ev6CSYHHfUQ\nBaCywrOmWXccuEYp7fVCmUZOSLtar2EnHfVOiIRHpHgwA7gSbP9DFir99BRV\nU/NC\r\n=/Xlb\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550116996244_1550117008118_0.9200358415125713"},"_hasShrinkwrap":false},"1.12.2-next.1550125345875":{"name":"puppeteer","version":"1.12.2-next.1550125345875","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"0b40d04b992085b484cc19ea3b24209713c66839","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550125345875","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-arWJDrsnk3QM/KfNJCBkiKuaiLcTmckenhFjy0IjlN2B5CRs1I6tDZCgqkW4mkVnqGaSEenzdVavJRPbdPnWyg==","shasum":"8ebf4975adba403b28c03c025630161756544bf1","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550125345875.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcZQkuCRA9TVsSAnZWagAATXMP/im+GMMq34FCxdefK3q5\n4rNrTi01ZtoNYwps3V3wq9W3Ix+PETeH/G3mKcce+jPAk6GbzSiLGyME18AG\nFGocT5uhSwsHFdNBoAByOyjSG5me8WM4oDSY0LJbifXlCt37ovfROBS5J00r\nYxTp2RqZhB9Yb5f4pMLUUBgI25NowAj/mw146fw2N14hiHSN2ny1q3RF18c4\nxWgmErb4waAJWHkDYIpo/Z+YeDXjJLKm2ybTsdJRm6ibYnCLyDE7vXajiPUM\na01Q4FCiAlFV16MV4eEYw5LmDZpHBF6WnUDCtSO9olK3bZ+HmoMJPupQba3L\nVlGrceZzXKLUGTcW/jLF++4CyXTasqBaa32af/U8v1VAA9rZs9KnSU0ZvRU3\nxdOJq6uM6GHV0sYGtQjf1zE4bNBS9wKFFD00WFe6SoFTUQiQEJ2NEZ2m0Qty\nT4d89PMu7a3U8dAtMANL+XOoDEvRajFh32zphei5uT9xoD1wYcnHkcwWAXUu\nqwZuGA4qFhRTSYDzXw6uBdDRC1zfsYu7hsYTUjNVCYpdWSO5rNa1d3rJ8TsH\nr2cEjHTiK5Gr5Vt7/1vVk9slmqpY7aFgwtB4BnpUmmroSEymu5xdTOf3I/L/\n/qYWMTUbwAsAEalQNOriCGhyn8MmA/lJUzyPAUGOT5IegpxVmpV/oS6yZacg\n9ngt\r\n=OVxx\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550125345875_1550125357514_0.014327671735537395"},"_hasShrinkwrap":false},"1.12.2-next.1550129406249":{"name":"puppeteer","version":"1.12.2-next.1550129406249","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"6350cf08925394d625f76a23dde26ab4ef1dde94","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550129406249","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-MP3WP5jeBiVpX0aoIOeDqgAFQC7zSidRRU0j+bhIvwh1dDIUP0ArGkdpWo81dUfQML6p1qLnNbaLbdTlwRmTyA==","shasum":"9c5b25c0f251a2665a031187582aa5f9d2012d54","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550129406249.tgz","fileCount":69,"unpackedSize":712333,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcZRkLCRA9TVsSAnZWagAAeh0P+wbM6Q2mcEKdnpkruVRy\na/Ar8vY8piIkKsQ2WsJw0CLMYFWqomsgtLUkVGbjCHbm9Le1AYDz/WmdfNeF\n0C6vEm/VZZLObYXE4BMxKEUItAwJiNKZbRyPhRTvhDfiP6Zp2PF+VVuC5mdg\n/d0qPWN+H3ct3p7ljV+ACi2FvZaEEz++ytgFm35zPGVT/rgW6mpZdU+QYkoU\nmV0hWY4WW6J05dYMP2uGXYZ0/SgITCgZ2EaBZLM4Zch8vbm9aARDwfGfVqWb\nLJkoNBYmvxpgitfDmeXgPwQPsd3UV1saEKnPGfNsWb1Y+e9BCHumxM7AB64D\n4JRlqW7D2e4G1xOKd4GFDiszIx3TODOB3XXkRt+gPQ7KsAcAMRogooY3g5ng\ns7+Vdf9n/4McAR9OxOabdPCmObLyvxk2rnj9FqaLHed5zQK4DgPzLQaNlggW\nOCzFiLiwGR93AzS24mLntbjj/Kg9oABSoFOn/A3xWrMUkrh1wIh4prQTz5U3\nCsYiLOp6f56gL2bjOEJp1NXpQAapAqWAYk3VxrvD8oFjYYbkf6b/spvGruS+\nw+HfqtmY4lPhxhrqT+5jDcj7Zv6MibEm/EgfahyYQEggdXiFzuuLqZ8H4pfh\nxlKdXlqCU5on+KS9Z2z9sxhNWv1kKdeLmYZlB1iaQA4Lu5ZKXzpPfLnZCYxe\nJQ8x\r\n=ekXv\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550129406249_1550129418796_0.35150149935655284"},"_hasShrinkwrap":false},"1.12.2-next.1550130473795":{"name":"puppeteer","version":"1.12.2-next.1550130473795","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"e8f044c3be13875b38581cbc5e9889e838c9851e","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550130473795","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-uS58XM2NmZilDeTokyTX2B85QY1ZUp0uJizEw9toXWDS9+uqCrfo1C7sFl3t4iJNfK0ra4U8XKj9gyhWcUBjVw==","shasum":"6cfcda9e99968cec6541dace53c715303dd4c156","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550130473795.tgz","fileCount":69,"unpackedSize":712429,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcZR01CRA9TVsSAnZWagAAWXcP/j30IvkxkeiPhAbz2fyt\nyhElD8o66DFsNAxF3NlyqqXfzlo9a30VAO7balRhf4DY9MR0yvgBglr3mulM\n8HY3wkuCEhUgcRBnKS4+TDoHfIc4E2n25CZHOB/0XF2/HmMMbDKd7Jj1gzua\nMaxmjXz1RKNaXcoxtABNYbaAZNL22377IC/EEfBEN3XHCFa5IfIqGMb/nrTQ\nLi4BQ2tUWWTJP3zPAHDqLhTYwvhs8plY7iNsl6ElPCTLsYXGgko2CLg8MsxP\nnIu6cDJgbn4tAty4Fu0bi4E/pPGWmonahqkvO4dYwxkELF91JsYYS2bwC2fm\n2nYFw1pufTW9u60WhuiXOK7QqFhXM8BO0wvXaz8LhMOXqYyB9aLG2ImXhj1n\nMuWwSNvU8rXfS+nXH9PCzHjM55meFLn//luzQsFnCHNcAsEmK/qafLInDLRd\nbeL+t1MkcCOND7tiEYKaxcE30SRTyUEjeZ3iwovbAlTK4LKWXRjO7036OJGO\nmShGAKcrM4uZJw1Gsz+6xn0p62poipMd1aWzwCV+DwcqAF5aVMKSmL77Nvav\n5yFfmZ9LucRR8NAyVawlXwBYAxGGFw2Om+ZQriEhSZ091n1P1vNHmnsMt55z\noDBwU5uLUAXpJF03Xujn4ySD5T9Zo6+wfQVRNnJgXfQj6MQY3RNZ5TmhiQ1i\nrvBm\r\n=WR2w\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550130473795_1550130484869_0.8271605849066281"},"_hasShrinkwrap":false},"1.12.2-next.1550131578606":{"name":"puppeteer","version":"1.12.2-next.1550131578606","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"247733b879039dc7a4ab30d90cacf3e2bdb07ed0","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550131578606","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-/eY7Id6+NqADHLH3gqhugIqK33NjAMJv4joC4ZveeXq9B015ODAzS82MM/ja2owIbFZtorpaDfUAr/N7OyYFHg==","shasum":"0bbbb6714d18576072f553d9abf7c2707542e591","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550131578606.tgz","fileCount":69,"unpackedSize":712429,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcZSGHCRA9TVsSAnZWagAAp3gP/jos4V0Jp2cimoTztwU1\nfa/A2VptZC4eI91InrZ680cxOK3YdH6djG38t5CxyXzvcb4LqyoZDKcJ+gij\niMfRs+uv8USeduH1SL4nwARl+XSZZygZVTG23oIbFxpCED3NznsfqgwS2aFk\n3INIKJxb1lPo5hQhUcAjoF0jQpEhxNkjegHHktwJrRsdQheIhVr+pdUcFEgr\nAGYVOCX0TdSJRVnMUtPkRUM+DaLo6TG5kTKAIpx+EnKYKZsAJnv7yPxfFCIl\nyRifrwhxsuPCECvOkjH4BIpmlLaBNcjFmwpFNmql3C54Ctdw/ps2YQ7UR9am\nJJFxAeS/UGwvXF68A95mfhgVpiAKQGIauJ+ejtEVR4LJ67tAYIsrAMpGhURh\nsqwwvte+iHBbguHZcgk03fEEOLMbnsDxp5yLHsAzteMCdjwSRALGA2FyddaR\nkNzuhzMTEtuYp1Sf5rbqYv/kYqyOMbRQ721S9ixiYeeSAcajrOWi1/gVoBR0\nXSj3OfCMGy2UNQWzdorMxym7DJ4XPq/cSuOuH6x3zxVrf+JPxEAFSE9Hpm4R\nmNoJwXfI6rJAHoSFXHkg1PIqtsa+3vQ1rJ0xKisCjxJpFE1MfJ0Nqt+uYSlr\nzapsjv/i1FBCQbUMf+iwLKIiK6azbhYpXm3heF7Nuj2nlwiZ90goSf6WOARo\nYfQy\r\n=roY+\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550131578606_1550131591004_0.03475500482445737"},"_hasShrinkwrap":false},"1.12.2-next.1550131956176":{"name":"puppeteer","version":"1.12.2-next.1550131956176","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"e0d4a5d2ec8d080d857dff5ed94ffd2cb3cded9f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550131956176","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-jRELcCqAWNALBI3QwsC38d6hBsznrgt0+SETKDDJzk3iYvkDM9nznWTNO6htOPiCKlxF829kBvawNJrY7qO5yg==","shasum":"7b19c73aa601fef41be96a4e1b827bc0b23ed973","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550131956176.tgz","fileCount":69,"unpackedSize":712429,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcZSL/CRA9TVsSAnZWagAAh5MP/j6XLmJ1bfZCMFLezdj/\nfF3K9edKGB6Iza6qlNFFLcX+BwqMYx1RGJsW15ujpTbCrBbU29IbX8mVzS3Q\nte3qEzcogfej09R8OkZaYJwfBl97O4bGmfArp7Xw1JjcONx3b7fURjyF75YK\n77jIGUzllsaUl2o0SM9j+DC4AjFlOPqLoks7sF9KS59rjMI9duO8dPIB9NQS\ne9ESAlGcZ9De41hgXbJarC3XkuUY4so6eLgA9cRce3hoviWMm1Y2cP689s9q\nfk4xlRIugzOFi5716t9AMnQ1AVZ2Eh4ZRv97iUb3cGmCRvkYnLQIuWQFxyF5\nwNNYfLPSYLxuxcz0oWCrFVpqSM3vbT75F/9+vgZUEoAfJx2UYuY3jdVID6qr\nZgsXo0lmvddyyQQZHyxIOtTNN2cbOCndx13+gjQ48bpnD9NhbqT1tibhZKM6\n8F0Qv+fUrlS0vPgGdACaH4PZmSsrnYUlCqIdLoKBwbNA+MD+KwGRMikftlFD\nm/Is9bnkm+sBAqMrE8i+XB1g0sUKOdCrzcRtnnKY5Mp6iUI6GhiBm0n/z4QB\n0nqiwUIb54+bns1i6TBKSrQNTF2t4vg8TrgqpKmMhBVyBuUNddieYwy7/kep\nvwFAn0a6MmMn+5m1dxvpXyRRn/q2mwSjFhUzSFUK8yvYEYsacUVWLRaAdxSf\ns6e7\r\n=KLst\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550131956176_1550131967189_0.5119153221512631"},"_hasShrinkwrap":false},"1.12.2-next.1550282653763":{"name":"puppeteer","version":"1.12.2-next.1550282653763","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"c35821a1a1c0348c03effdf14cb0eb8186ecad32","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550282653763","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-/9WfHhC1A3yedRdKd7d5eTewuOB7ESDuFoWVb4MRCqwX9BWn/lDM3cLsTe1vV7cl7M8Pql78da2pjdYTfgSNIQ==","shasum":"28d7b3344b94ee45dc00896ea7b0b8918a24aa3c","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550282653763.tgz","fileCount":69,"unpackedSize":712429,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcZ2+pCRA9TVsSAnZWagAA2IgP/2FHHxdgU97Io+wON3uI\n7m3UX2l6GBL8zDj+2LBlh5wxdY9ztiR+Dbqkk6vJkMYeKhXl41N/ljPtjZND\nZakoaHmWYnQZWsU7OGiX1JkYyDTtkHiqXpiEx6tF4u13VHthKts2/Kzb8kfE\nypOdk+5gYXXdpGczm9qs15h/yyuVFzRr5r0zUQJpI1eLVRdKj8rSy1MjWQqU\n4pmXaoHnTVjGdFps8gQQYXzRZSCyayMA0CPHf9FAnJE1S9kaoQbWAmmV17MO\nZemooI9hkrLFGjYDX0V6ErFSEGWLjP+TcCGVjmaiNp0dR1SwUNH+TN5EQb4K\nRrSSJt95FQQYizIy1KW/YvgI+O332h65F0N8vMZQFo7bHhPT9Xgvpf3j1NQS\nryOd/oP8s/rYJRuAySHzBMDW1LTd1sBTcXSUY0jnqwfkzgR5jvo/7yNHnz0+\nutKGrlvFzdgzeDkQmX8BA2kF33ICfAt5q2D0xk9HXjeT2v+ncLhv8Bxzv84n\n8cFHDmwaxj/vO52nghUe2FKiBKW2H2i65NebN1N+s0pwZuxgtTaaLfW/QBZk\nqKGWT2zOJsZAJeaSKae8HBwPuDq3RNMIWgQTMihGYSvx9LUojL55TdPP8qAh\nySpZE+iVecoWSDwMXR7ao04pc+sTQ0RuE3iS9mCFpayKGXZ9OKu9OORrqHlw\nRe9V\r\n=XzST\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550282653763_1550282664997_0.38589011239116533"},"_hasShrinkwrap":false},"1.12.2-next.1550284380471":{"name":"puppeteer","version":"1.12.2-next.1550284380471","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"9782f9c82777fa4a18a4a3068f42c2c14ebb761d","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550284380471","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-8REC3JnPt/pkONLQJD3HIK4Ir+zfR9Ms5vszqoQQht4VQEyJPVg3TMARc39Zy28Kk8hrUDVEl+O043QPtRxKFA==","shasum":"59ce827f1a772bbb63432ab3615b245f3621ef36","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550284380471.tgz","fileCount":69,"unpackedSize":712429,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcZ3ZpCRA9TVsSAnZWagAA7cIQAIxeyQimTsCI73MwsMPH\nxPZqAebc+lThLrWaoPTy8ivzvSe5QHoT2Ugsos4H7BIAar9MmTc2rHx24r8S\n3Dr2qsywKWPW00ix2Oi66sPGq1iF8QBgrgpxcmSQC+aM5eaZYzv8ERZ1wkTE\ntuSZsGfXkjSqVLSl0ZAT9xyLzrdMxae9+dAIoZNko03OsM5TKTVSFOGGoP1X\nAvCsgZJhE4mMrSzIUV4mHAx051qEb326ON6IulX7h5T2cqQiQQYNuUbmBIwi\nOyEYNeOfPGmKtGrdFpKtbiSDOiSKEGrplYNQQdFOKfyfARABpalG/Rr+/Ztx\ngq7E+mHhhkFsQ0LsCnm6vrHGz6v0h4xIe/M2NYO3kCgiE0rdGupwXUcF2Wvj\n90bBrQ0lV1uSwBCPNEj0aD7eVk583UvjSB22bNld4qRb5aEUHTVeoY9EeYtS\nVZUoiLc5V6IPNtLd1H3w2RDBR29KZnxEYgcbmvWizNhZihXOXQz/ussubw7I\nucFaL3L+cgkcvRjAL+GJkGxv7M9As7b6GKYH9RZA0+5x+IJO4+5KuxBFE/wg\nHyZZgw7j+PjhmA/8KSAPJ54lumno1xK3pswVT1o99IUV0w443EDvZ2DCB0R2\nPt9wmGmjdR0q5JWYNxj6l6R178zSVB4wZ/c4iLttoDlQuE4WZAwKi6Y+YNuq\nIxhL\r\n=rB1d\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550284380471_1550284392506_0.8967868083900381"},"_hasShrinkwrap":false},"1.12.2-next.1550428217621":{"name":"puppeteer","version":"1.12.2-next.1550428217621","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"4a4793a5e18725653b0de792df89daf6323700cb","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550428217621","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-uh/xmSnBREWfH9pmKgXJUCDB4Zj4nRgD0cU4FCNQQ0Esv71jFl3KYJPIqNp3qieXuljKKafaNOA7Uh6kYpQkaQ==","shasum":"36ca5a0ed99532ac5d60d30022a6b2cf2ff6b23e","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550428217621.tgz","fileCount":69,"unpackedSize":712429,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcaahHCRA9TVsSAnZWagAArFoP/3oet+S0tj8WjqkS/DK4\nBfy2XDkSJNSxddLuC8Q3RckNIpbjoMy1wKBSsiLaEPAX8/uh4gg2TK2P3l+R\njDI1zhle80NPBvtZsfQ1tPc2q/qc8Zqxvtt/ReI/538x9KeSyX7Ou9dmt42i\nQAt5WXdiC4oxToDMOYdGLeIItisSs5p4E697w3cfRqCmXBZ4FtdXWMbEDZai\ngXkB3lrwiX3fG2mAHo9xhoR7GP7wz+OTYxPa5ORu8xXqfPA188dohX4XTseX\nv8rLD9ow4ej52TuyCS9G65zztA8YtvHw4H95brqVNHLxopZ8xYrItaXiW/aP\nVvgy5Vs3JNyMKJk+ZouXYX4R4AU7TtECrethDyd9CuJffAxPVGgkoKPV6mwO\nsB4NjTBWJxGal4JP1r9GLhzpjb7j9cejb1wY9er42Qpx/0siVtbAYLqKePBd\nFLuJGjKmg/Tx6Yx6MzpuBpT3gSOAl7Qgf3BCAy0cB/tZujiVJ9agfSf55wVe\ndCuT25CWiK9bMOkYU8r0ouu0cauaur0lfNXV+ZquV8smtyZnh4r+BGS9xtRz\npPwt0B7rHvp0J1mgWfylfWMtfwXLYx6YtlNi783DARBfSZLUCFL/dJIQFRuY\n6323FsbdEFzT29yDsYfop6VQ2DB4+y4mfC/l6P+0PP4/X/nhc5OkX0ObL3GQ\nxT92\r\n=FWK0\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550428217621_1550428230694_0.7720411097999262"},"_hasShrinkwrap":false},"1.12.2-next.1550611648487":{"name":"puppeteer","version":"1.12.2-next.1550611648487","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"3b180923a62cfa570e8a628bba4857eeb3b45c07","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550611648487","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-PczNS7ayq1caIsobg6+EKJj36i3eFGDckNKtYvAh5Fr7av7PuO2uxBVInHEDauRL1xOT/lE6/B9MH/pUp46sXQ==","shasum":"3231bcf220e2cbcbcb2a14a4063f177d0f595880","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550611648487.tgz","fileCount":69,"unpackedSize":712429,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcbHTNCRA9TVsSAnZWagAAUPwP+QFQLEGrZZaS6R0Z51ZA\n5gRFQt9EjqTal6tOaJQPnwLnwuuodL0MnZBWk2B5OOSC2q0ghaw4F5dDawKv\nNnMdD0Mtd7RWHpoCnk4+jpUxSnhputyV/XBCJo0TW8To2fuI0tafCEWId2NL\nbCqYdcDcPI7iJZ0dutJHcHDlRtWkXDfHnAWtb9yk7VMbi7nTWQ5n+x46qyqp\nOAetaQEsi/vVhGT09HOIFYxlecn9Ymlt+cKtLUljclrCaTKC0R4MH6jm6P3f\nUJt+QH+YeAaX5qUCP53lckTru1Mh+S8E3vZLAlntO7U9ibRIKZT9+MXT88Rt\nUNJkr+9X/OAHWE+sbu8T1qfTdz8Ze77J4Cyn60bZmkCJoMhAvOO76vmRmsMB\nd7c15zzQAvCWqvf5mmxFjjAMuVvZdijlTefR78biQR7XQgqJv7O1+DDebzqC\n6shOau0x0hcEzUTn1YWdqLx4r1y/ERiDQbHUoKSXti1EsYo6c5zswyAb7k9s\nY+o+lpMLheZmh0c0oUUqSD3bfcUIAcQKdYT0QwaA42+QLXtH9AdyaTqKHj9+\nkPzXnaTpBPnsB6vakjMVSvT86toBPotrvZ1uL4EG0LY+tCMtb7Sp4S/aUsb+\nrgEcIsJ4t063h/GF+YakGpX1LoIKGIlYtE4IKj0ljHrkj3/tCtCq99JuvyUc\n6w/3\r\n=gOWF\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550611648487_1550611660795_0.5177133157416904"},"_hasShrinkwrap":false},"1.12.2-next.1550617121272":{"name":"puppeteer","version":"1.12.2-next.1550617121272","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"c118b208fa639ad45d94f41488441ee241353e6e","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550617121272","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-7gGC6Tgs9YM8W2U0k5j9rwi+8icfkrkoJ2xwTliUTaHBd0+SP9AvUKG6fSnBw5PA/VNK5wa5GF0UvNEqtlh+pA==","shasum":"a1f262c08e286f0135c93e22600b94e1f66180bb","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550617121272.tgz","fileCount":69,"unpackedSize":712429,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcbIotCRA9TVsSAnZWagAAKsQP/0MOOPhI0uEml4gCisXU\nQoP6Nl7rCKI37NakzEbE3x5YuzxU+rt5iv+2LVxAz4xhTnxlYOFSRgBK19ji\ngsi4o61OrElLs5YCxvSxW3Ns7IdHXlYBhS5gqq5JwhRcq423OPj+VyYygcLr\ndtzgmX4QqZbInIcZeR9FALQuG7JoC2jTbW67yCuYJ64Uk/TTJm/dVZaJqOJ/\nqhD6I14FuwVpO41LtQtN1CihqgH5HWLLEfxMCfXmXKz9Q0APBALhtix9+sD8\nwJlJNF5rsnJbsuVfSKMc5Bt6CEXJSMGornhXCV23kutJ//s1514kze5VCyEu\n61TvCi4Dql1Cz65coEUN+JTRb7pUVNeOVdKEWJBLiBbdNyXp0mL/2dIZPZu7\nHFYJIkjBK9u1MHvczebY6kohvr2WTH0jW9FaRga+Pwc8SxBe3QdH7yVmC2Vx\nSlp9SqQ/4vu6XLU6YGikiGb/wMoMt2+xVIVCClHeHxiqzI4MI58AbqXyODZ/\nbtkN5kC/8F4aTDyo8OYu1A2E7rSSBpr6ijKcCho1YflYkF9YB+BLL0yfjJ3f\nZnCawnZegCkwZDGepCRxZajNi2jjMokPWDJrvRDZ/TATe+aCisuppwcL6mJf\nxu/GRflQ5oFOe9h+eawVQFtmM0dgu3x5FRanyKEiaG72MujmfI/Wax+iAu2a\nVA7h\r\n=pbBB\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550617121272_1550617132705_0.1247488568226065"},"_hasShrinkwrap":false},"1.12.2-next.1550618944816":{"name":"puppeteer","version":"1.12.2-next.1550618944816","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"719ee5af3dc4ce419dfe9046d087cf96fb1bec00","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550618944816","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-GW1M7FKNT3jQfktX7HrGn71O6zUH8Ijy8sQ81HgghPVpNc0n2NCA1t9Jz+FOCHM79hw21ENGR7b0RkjwwxXymQ==","shasum":"1a9397a75db288a92330abc87bb42fda29f07887","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550618944816.tgz","fileCount":69,"unpackedSize":712429,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcbJFNCRA9TVsSAnZWagAAuWcQAJYnSsCJEapNVgvyWjAI\nZqZlmv49djEDOHuqODmNZ9m1dDs6doNKj7C0KGRip9+Ddx1298BkKJYltMJA\n7rQMB7/EYnGKlekbyjDcQtMECMw9Hp5a9Y679v7odYiJyStEg9a+Y4tcTMM+\nKYFi+opUSgiQDZv5XbhN+bmw8s+Qg4VudwWw9hztMoNROO/cdSNrwzPOlHPx\nOLImW/lzhcyam6D5hvPOw9VCxJ84+PfdPz1ycY4tOc8ed+fiHInXuThEqxg0\nib/EX1Qoher9RhcquOePlWBwi7CUCtJxxRo0zO6Fc52HB5a4j8E3lqEGw61y\njo+kR1QXFPjoD5Vl907PugIhCtWKFNFe/0GD+0FHj6r4l0qgyal4kDUbw7BF\nUGkjUTckMz085OssTXrAAhqpHXUyqagB97OedPN6DjQ7uE6/T6+A6Tx9DMto\nrLVRQcXzdBdVzmP30AINruQGeHh6HywsQTeuRkq6/VSv1TfwVkcZvTRi7ePd\np+/EN8WyDROjnolmaGDDPsEbC/7A00L94om17nMbEP354ifZAixI86hRX9I4\nT+jUUFXcjsblz/nG+tsaM1NNbERKJyDkSJLcFGNW5ZPBv1Yoc2w92GVMHDfq\nezLZ6PvB6+ha+j7sT/eNxs95uKAMdNJfmAG8SdpcdIDN91R2YvOxx6zB0c+4\n837J\r\n=EKT/\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550618944816_1550618956595_0.3513533801517086"},"_hasShrinkwrap":false},"1.12.2-next.1550643350858":{"name":"puppeteer","version":"1.12.2-next.1550643350858","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"03c542a6c1d93f823ed91c8a266f9d8eca8e5f3e","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550643350858","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-kHwyur62qDWm4o4eW23gLRGUBkpCH8kEBkVqjNAJ94Io0vFl27o6S7h4BP6gksZxgszunLxwdZXe+mxyBti1Xg==","shasum":"e2d680100ad7093e052930bfad17b7cd9ba47218","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550643350858.tgz","fileCount":69,"unpackedSize":710645,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcbPCjCRA9TVsSAnZWagAAGZ0QAIgnIUCnfaIxfBE82V6I\ndKAFjdP+BJle8hCmpkjNgdZNMK9UB3z6h2SeqqhB2xFZ685jXtKeKb5Zb8QB\nTPWYdBXUPq6dEB0RbRGOOA8Iwms/W+vrV6+kspbkl5qujoJgutzu8g5MQ/Mg\nJRRjPObrqV2TPpqLo9/R/hrOqnlMlLjC2ljmoWo2wmYlJp8GFKNGP6QXjgZf\nJ2X4oTrPw7z7AbOW8+eYtHthehIMpOHddqe9nf5Hu2UVZ+8Km+wksXbFvEcR\n03BgN0IAdB7qTm3iEmM1122cSDwy5Cw0zeJurRCq0w5CgW7JyAzMFtyDkwGk\nt6gjP0QXBrMeHcm+MNJ1Kms354ZRClIF6wVBgBA/ZVmqEru8JYqNFNtQpVjt\ntTIc/6p7KyJpWVUDXwnH6NicZ2NLXEOi0+KDjFvwU6sjREcFIPA2ILeqPZaD\nGP5cJxoTRrlh0M5BjrJKKiu/LfR0id0NjL3zMOje9+PZPXWdcDK/4KoFR2i/\nEJX8+Jk1HmKp+vuY4/U6448GF5oYLBqMSWb9pSlRgpNS04MfO9ECYlJm/P9x\n8fEQUtk4z2dElnEuMWbJ/5w7wEWRUqGBmtEtOfyDwXUvTyK2V4OIyTp0tz6R\n0qm/V35n9gCKgGAXCYgcatNpu+gmQQsJIqZr6BI/1LmJu59Cl/hueXA5AjDn\naAVj\r\n=q9rt\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550643350858_1550643362529_0.629007871229045"},"_hasShrinkwrap":false},"1.12.2-next.1550645075490":{"name":"puppeteer","version":"1.12.2-next.1550645075490","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"a0fd2ce3fd3b8a05a3a3c4fdc669361285ccb48f","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550645075490","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-ZxYT+gWQRO1h0PTuu9DGGtn1PmFsieg5o87/MMzZKo/ET5M1Rtm/pNK7Gb8zQUyTcSxnHCkRZ6p4+7OEgXjt0Q==","shasum":"a154b9d89907288ad1a8c1b081eb44b713a9d9c2","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550645075490.tgz","fileCount":69,"unpackedSize":710645,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcbPdfCRA9TVsSAnZWagAAgPIP/AuI0nzRokOny55tKspI\nJuqli1mcGVRiOrDZQBXLsa3I7y7ks2QowtBj1adxkpd8zy9OEyS50c15mc32\nvTp9OAe3ais5Z3gr2FsBSkeNRd7jO4ohy/SvxVWX9PoY2anSQ5rGKDDHpw3R\n55R9tS81Rr1Fc4H1kkoDMJDqKL4J4OwGDoAPBOYjY3hhF0xgoSMdsncNJKBi\nW9ifhTlxw9CzX6Au0s/msQyeomXQ3cvXgBGQDFdHtxc7hTkQcSq3kAqmHc2f\nm9ZlGW5z5NhifprmZPhLu5G9SQWUZxrKdA0jrzq4FZGmQOI7AEYAGM2Y1CEx\nqmWiSiN+sazsCu842tX9l4L0c1I91o+MktyRD91rItg2UbGLryVGUWH03H5i\no5rhj8He+7DtvK0aBDCRJpkCywhho0EIotksxz1lONY6kjXtnqM+zan1uc0C\n26qwk9+DmsVGtCUqKOlZZ/0jPwsQcDEC0MKRglWezLMFyBykZAi+V5GNfF8r\nGHXtHrPV81wujrTubPDGlWtwYw+thZTZc9fKX/i5JZ0/0Pp7YXpFx6lXosqL\n4er/ZXZfLbNJM7g6hZxGXwCv3ZUYMXYjXWilV/Gp4/bfskd57UfekL/PyxeT\nxxle0vMnEfAgRQ0hv6kfy+WPcYBIXdEgq/nZ/TMOITFlqdCLqrTee+OB8EeO\nh8NU\r\n=PrME\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550645075490_1550645087117_0.489932524442793"},"_hasShrinkwrap":false},"1.12.2-next.1550772889548":{"name":"puppeteer","version":"1.12.2-next.1550772889548","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"fbf91cca982aff9549d593fa85aa137278e6847c","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))\n\n - Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:\n\n `await page.evaluate(() => {debugger;});`\n\n The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.\n\n5. Enable verbose logging - internal DevTools protocol traffic\n will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.\n\n # Basic verbose logging\n env DEBUG=\"puppeteer:*\" node script.js\n\n # Debug output can be enabled/disabled by namespace\n env DEBUG=\"puppeteer:protocol\" node script.js # protocol connection messages\n env DEBUG=\"puppeteer:session\" node script.js # protocol session messages (protocol messages to targets)\n\n # Protocol traffic can be rather noisy. This example filters out all Network domain messages\n env DEBUG=\"puppeteer:session\" env DEBUG_COLORS=true node script.js 2>&1 | grep -v '\"Network'\n\n6. Debug your Puppeteer (node) code easily, using [ndb](https://github.com/GoogleChromeLabs/ndb)\n\n - `npm install -g ndb` (or even better, use [npx](https://github.com/zkat/npx)!)\n\n - add a `debugger` to your Puppeteer (node) code\n\n - add `ndb` (or `npx ndb`) before your test command. For example:\n\n `ndb jest` or `ndb mocha` (or `npx ndb jest` / `npx ndb mocha`)\n\n - debug your test inside chromium like a boss!\n\n\n<!-- [END debugging] -->\n\n## Contributing to Puppeteer\n\nCheck out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.\n\n<!-- [START faq] -->\n\n# FAQ\n\n#### Q: Who maintains Puppeteer?\n\nThe Chrome DevTools team maintains the library, but we'd love your help and expertise on the project!\nSee [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md).\n\n#### Q: What are Puppeteer’s goals and principles?\n\nThe goals of the project are:\n\n- Provide a slim, canonical library that highlights the capabilities of the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/).\n- Provide a reference implementation for similar testing libraries. Eventually, these other frameworks could adopt Puppeteer as their foundational layer.\n- Grow the adoption of headless/automated browser testing.\n- Help dogfood new DevTools Protocol features...and catch bugs!\n- Learn more about the pain points of automated browser testing and help fill those gaps.\n\nWe adapt [Chromium principles](https://www.chromium.org/developers/core-principles) to help us drive product decisions:\n- **Speed**: Puppeteer has almost zero performance overhead over an automated page.\n- **Security**: Puppeteer operates off-process with respect to Chromium, making it safe to automate potentially malicious pages.\n- **Stability**: Puppeteer should not be flaky and should not leak memory.\n- **Simplicity**: Puppeteer provides a high-level API that’s easy to use, understand, and debug.\n\n#### Q: Is Puppeteer replacing Selenium/WebDriver?\n\n**No**. Both projects are valuable for very different reasons:\n- Selenium/WebDriver focuses on cross-browser automation; its value proposition is a single standard API that works across all major browsers.\n- Puppeteer focuses on Chromium; its value proposition is richer functionality and higher reliability.\n\nThat said, you **can** use Puppeteer to run tests against Chromium, e.g. using the community-driven [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). While this probably shouldn’t be your only testing solution, it does have a few good points compared to WebDriver:\n\n- Puppeteer requires zero setup and comes bundled with the Chromium version it works best with, making it [very easy to start with](https://github.com/GoogleChrome/puppeteer/#getting-started). At the end of the day, it’s better to have a few tests running chromium-only, than no tests at all.\n- Puppeteer has event-driven architecture, which removes a lot of potential flakiness. There’s no need for evil “sleep(1000)” calls in puppeteer scripts.\n- Puppeteer runs headless by default, which makes it fast to run. Puppeteer v1.5.0 also exposes browser contexts, making it possible to efficiently parallelize test execution.\n- Puppeteer shines when it comes to debugging: flip the “headless” bit to false, add “slowMo”, and you’ll see what the browser is doing. You can even open Chrome DevTools to inspect the test environment.\n\n#### Q: Why doesn’t Puppeteer v.XXX work with Chromium v.YYY?\n\nWe see Puppeteer as an **indivisible entity** with Chromium. Each version of Puppeteer bundles a specific version of Chromium – **the only** version it is guaranteed to work with.\n\nThis is not an artificial constraint: A lot of work on Puppeteer is actually taking place in the Chromium repository. Here’s a typical story:\n- A Puppeteer bug is reported: https://github.com/GoogleChrome/puppeteer/issues/2709\n- It turned out this is an issue with the DevTools protocol, so we’re fixing it in Chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1102154\n- Once the upstream fix is landed, we roll updated Chromium into Puppeteer: https://github.com/GoogleChrome/puppeteer/pull/2769\n\nHowever, oftentimes it is desirable to use Puppeteer with the official Google Chrome rather than Chromium. For this to work, you should install a `puppeteer-core` version that corresponds to the Chrome version.\n\nFor example, in order to drive Chrome 71 with puppeteer-core, use `chrome-71` npm tag:\n```bash\nnpm install puppeteer-core@chrome-71\n```\n\n#### Q: Which Chromium version does Puppeteer use?\n\nLook for `chromium_revision` in [package.json](https://github.com/GoogleChrome/puppeteer/blob/master/package.json).\n\n#### Q: What’s considered a “Navigation”?\n\nFrom Puppeteer’s standpoint, **“navigation” is anything that changes a page’s URL**.\nAside from regular navigation where the browser hits the network to fetch a new document from the web server, this includes [anchor navigations](https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid) and [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) usage.\n\nWith this definition of “navigation,” **Puppeteer works seamlessly with single-page applications.**\n\n#### Q: What’s the difference between a “trusted\" and \"untrusted\" input event?\n\nIn browsers, input events could be divided into two big groups: trusted vs. untrusted.\n\n- **Trusted events**: events generated by users interacting with the page, e.g. using a mouse or keyboard.\n- **Untrusted event**: events generated by Web APIs, e.g. `document.createEvent` or `element.click()` methods.\n\nWebsites can distinguish between these two groups:\n- using an [`Event.isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) event flag\n- sniffing for accompanying events. For example, every trusted `'click'` event is preceded by `'mousedown'` and `'mouseup'` events.\n\nFor automation purposes it’s important to generate trusted events. **All input events generated with Puppeteer are trusted and fire proper accompanying events.** If, for some reason, one needs an untrusted event, it’s always possible to hop into a page context with `page.evaluate` and generate a fake event:\n\n```js\nawait page.evaluate(() => {\n document.querySelector('button[type=submit]').click();\n});\n```\n\n#### Q: What features does Puppeteer not support?\n\nYou may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, [video playback/screenshots is likely to fail](https://github.com/GoogleChrome/puppeteer/issues/291).) There are two reasons for this:\n\n* Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of [Chromium's media-related limitations](https://www.chromium.org/audio-video). This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the [`executablePath` option to `puppeteer.launch`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions). You should only use this configuration if you need an official release of Chrome that supports these media formats.)\n* Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer [does not support HTTP Live Streaming (HLS)](https://caniuse.com/#feat=http-live-streaming).\n\n#### Q: I am having trouble installing / running Puppeteer in my test environment?\nWe have a [troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md) guide for various operating systems that lists the required dependencies.\n\n#### Q: How do I try/test a prerelease version of Puppeteer?\n\nYou can check out this repo or install the latest prerelease from npm:\n\n```bash\nnpm i --save puppeteer@next\n```\n\nPlease note that prerelease may be unstable and contain bugs.\n\n#### Q: I have more questions! Where do I ask?\n\nThere are many ways to get help on Puppeteer:\n- [bugtracker](https://github.com/GoogleChrome/puppeteer/issues)\n- [stackoverflow](https://stackoverflow.com/questions/tagged/puppeteer)\n- [slack channel](https://join.slack.com/t/puppeteer/shared_invite/enQtMzU4MjIyMDA5NTM4LTM1OTdkNDhlM2Y4ZGUzZDdjYjM5ZWZlZGFiZjc4MTkyYTVlYzIzYjU5NDIyNzgyMmFiNDFjN2UzNWU0N2ZhZDc)\n\nMake sure to search these channels before posting your question.\n\n\n<!-- [END faq] -->\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/GoogleChrome/puppeteer/issues"},"homepage":"https://github.com/GoogleChrome/puppeteer#readme","_id":"puppeteer@1.12.2-next.1550772889548","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"aslushnikov","email":"aslushnikov@gmail.com"},"dist":{"integrity":"sha512-OgQ0MAoAc95Kkx68bmSTtqht+C3oQldLxBH7iuFQ77GqvSqGAR6YszAvLoVlfe+6axuEJkJRq3i3Dwu/uqKtqQ==","shasum":"4dfc118f11ec5607079e0d92df70fe40185494e9","tarball":"https://registry.npmjs.org/puppeteer/-/puppeteer-1.12.2-next.1550772889548.tgz","fileCount":69,"unpackedSize":710645,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcbuqmCRA9TVsSAnZWagAAFwgP/1t3/4PBpqShPrTv8NDK\nuZUJo5zs7WXaL0UWoNNzzWcfuCloI6QLKWKIJ47uY/FsSj/e9+djZ2sE14jr\noOY9CO2WGiTyYkNpD+brJFc48xOTBtapHdCdNZ2dCYIgZswQSagcOvuIgmmY\nC3x4IuYRqH/sxehLFmtHwo3bCuRVuiERTGshqQvFVO5jPgUUQyWau5naMX0Q\npkOeclYgUHjgCQ5JCOMpL6+0GoFFLFw6NVbjLTxNjEaKoSltEbZDZ8DlivKE\n7UyYTF9i2gIZbV3qBYr4SXkGEvNo/NSfT+GDGBFS3YVdElnLbJZCc3HsSMXk\nesIPYjgKlbHyzWok7vhEPmJS6uPTmcRMUOILYsLc00H8t1SR3vykEmI4AaVG\nJuU2LaC67gVyr92jKBF5/JbhX43YS4D5IH15q8TQKN5CokiCMjbiTpNwHGoh\nWUSiybHssQDbU3Q2B3TcHIfveDDARZ7ZsThDrtcnAYOBE/zD16/vbjO5RZmf\nKe7lVdZmK4JKY/i676GS10ha9tE+Th+bb+svV2yds+hS+Yw7Vtfrn23hHoyO\nnDvKw+Vpa+Y/9pQbKxRxSmLC2DOgtcOfhrw/tJGtHfkaxbFp1uA7BajtwVE6\nBD8la0zembjzySM6oUKTOSmAI19luVc0WhX5klm9pxCqYH6z/xnVb+elUBSO\nJbJY\r\n=1N/Q\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"aslushnikov","email":"aslushnikov@gmail.com"},{"name":"ebidel","email":"ebidel@gmail.com"},{"name":"paulirish","email":"paul.irish@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppeteer_1.12.2-next.1550772889548_1550772901438_0.8583563243333219"},"_hasShrinkwrap":false},"1.12.2-next.1550783848074":{"name":"puppeteer","version":"1.12.2-next.1550783848074","description":"A high-level API to control headless Chrome over the DevTools Protocol","main":"index.js","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/puppeteer.git"},"engines":{"node":">=6.4.0"},"puppeteer":{"chromium_revision":"630727"},"scripts":{"unit":"node test/test.js","funit":"BROWSER=firefox node test/test.js","debug-unit":"node --inspect-brk test/test.js","test-doclint":"node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js","test":"npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-node6-transformer && npm run test-types","install":"node install.js","lint":"([ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .) && npm run tsc && npm run doc","doc":"node utils/doclint/cli.js","coverage":"cross-env COVERAGE=true npm run unit","test-node6-transformer":"node utils/node6-transform/test/test.js","build":"node utils/node6-transform/index.js && node utils/doclint/generate_types","unit-node6":"node node6/test/test.js","tsc":"tsc -p .","prepublishOnly":"npm run build","apply-next-version":"node utils/apply_next_version.js","bundle":"npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js","test-types":"node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/","unit-bundle":"node utils/browser/test.js"},"author":{"name":"The Chromium Authors"},"license":"Apache-2.0","dependencies":{"debug":"^4.1.0","extract-zip":"^1.6.6","https-proxy-agent":"^2.2.1","mime":"^2.0.3","progress":"^2.0.1","proxy-from-env":"^1.0.0","rimraf":"^2.6.1","ws":"^6.1.0"},"devDependencies":{"@types/debug":"0.0.31","@types/extract-zip":"^1.6.2","@types/mime":"^2.0.0","@types/node":"^8.10.34","@types/rimraf":"^2.0.2","@types/ws":"^6.0.1","commonmark":"^0.28.1","cross-env":"^5.0.5","eslint":"^5.9.0","esprima":"^4.0.0","jpeg-js":"^0.3.4","minimist":"^1.2.0","ncp":"^2.0.0","pixelmatch":"^4.0.2","pngjs":"^3.3.3","text-diff":"^1.0.1","typescript":"3.2.2"},"browser":{"./lib/BrowserFetcher.js":false,"./node6/lib/Puppeteer":false,"ws":"./utils/browser/WebSocket","fs":false,"child_process":false,"rimraf":false,"readline":false},"gitHead":"ed984ac47983ae40cbb2e532b58f3a9c9ef1afdc","readme":"# Puppeteer\n\n<!-- [START badges] -->\n[](https://travis-ci.com/GoogleChrome/puppeteer) [](https://ci.appveyor.com/project/aslushnikov/puppeteer/branch/master) [](https://cirrus-ci.com/github/GoogleChrome/puppeteer) [](https://npmjs.org/package/puppeteer)\n<!-- [END badges] -->\n\n<img src=\"https://user-images.githubusercontent.com/10379601/29446482-04f7036a-841f-11e7-9872-91d1fc2ea683.png\" height=\"200\" align=\"right\">\n\n###### [API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md) | [FAQ](#faq) | [Contributing](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) | [Troubleshooting](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md)\n\n> Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the [DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/). Puppeteer runs [headless](https://developers.google.com/web/updates/2017/04/headless-chrome) by default, but can be configured to run full (non-headless) Chrome or Chromium.\n\n<!-- [START usecases] -->\n###### What can I do?\n\nMost things that you can do manually in the browser can be done using Puppeteer! Here are a few examples to get you started:\n\n* Generate screenshots and PDFs of pages.\n* Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. \"SSR\" (Server-Side Rendering)).\n* Automate form submission, UI testing, keyboard input, etc.\n* Create an up-to-date, automated testing environment. Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.\n* Capture a [timeline trace](https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/reference) of your site to help diagnose performance issues.\n* Test Chrome Extensions.\n<!-- [END usecases] -->\n\nGive it a spin: https://try-puppeteer.appspot.com/\n\n<!-- [START getstarted] -->\n## Getting Started\n\n### Installation\n\nTo use Puppeteer in your project, run:\n\n```bash\nnpm i puppeteer\n# or \"yarn add puppeteer\"\n```\n\nNote: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win) that is guaranteed to work with the API. To skip the download, see [Environment variables](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#environment-variables).\n\n\n### puppeteer-core\n\nSince version 1.7.0 we publish the [`puppeteer-core`](https://www.npmjs.com/package/puppeteer-core) package,\na version of Puppeteer that doesn't download Chromium by default.\n\n```bash\nnpm i puppeteer-core\n# or \"yarn add puppeteer-core\"\n```\n\n`puppeteer-core` is intended to be a lightweight version of Puppeteer for launching an existing browser installation or for connecting to a remote one. Be sure that the version of puppeteer-core you install is compatible with the\nbrowser you intend to connect to.\n\nSee [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core).\n\n### Usage\n\nNote: Puppeteer requires at least Node v6.4.0, but the examples below use async/await which is only supported in Node v7.6.0 or greater.\n\nPuppeteer will be familiar to people using other browser testing frameworks. You create an instance\nof `Browser`, open pages, and then manipulate them with [Puppeteer's API](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#).\n\n**Example** - navigating to https://example.com and saving a screenshot as *example.png*:\n\nSave file as **example.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n await page.screenshot({path: 'example.png'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode example.js\n```\n\nPuppeteer sets an initial page size to 800px x 600px, which defines the screenshot size. The page size can be customized with [`Page.setViewport()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagesetviewportviewport).\n\n**Example** - create a PDF.\n\nSave file as **hn.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://news.ycombinator.com', {waitUntil: 'networkidle2'});\n await page.pdf({path: 'hn.pdf', format: 'A4'});\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode hn.js\n```\n\nSee [`Page.pdf()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pagepdfoptions) for more information about creating pdfs.\n\n**Example** - evaluate script in the context of the page\n\nSave file as **get-dimensions.js**\n\n```js\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the \"viewport\" of the page, as reported by the page.\n const dimensions = await page.evaluate(() => {\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n deviceScaleFactor: window.devicePixelRatio\n };\n });\n\n console.log('Dimensions:', dimensions);\n\n await browser.close();\n})();\n```\n\nExecute script on the command line\n\n```bash\nnode get-dimensions.js\n```\n\nSee [`Page.evaluate()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#pageevaluatepagefunction-args) for more information on `evaluate` and related methods like `evaluateOnNewDocument` and `exposeFunction`.\n\n<!-- [END getstarted] -->\n\n<!-- [START runtimesettings] -->\n## Default runtime settings\n\n**1. Uses Headless mode**\n\nPuppeteer launches Chromium in [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome). To launch a full version of Chromium, set the ['headless' option](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) when launching a browser:\n\n```js\nconst browser = await puppeteer.launch({headless: false}); // default is true\n```\n\n**2. Runs a bundled version of Chromium**\n\nBy default, Puppeteer downloads and uses a specific version of Chromium so its API\nis guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium,\npass in the executable's path when creating a `Browser` instance:\n\n```js\nconst browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});\n```\n\nSee [`Puppeteer.launch()`](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md#puppeteerlaunchoptions) for more information.\n\nSee [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.\n\n**3. Creates a fresh user profile**\n\nPuppeteer creates its own Chromium user profile which it **cleans up on every run**.\n\n<!-- [END runtimesettings] -->\n\n## Resources\n\n- [API Documentation](https://github.com/GoogleChrome/puppeteer/blob/v1.12.2/docs/api.md)\n- [Examples](https://github.com/GoogleChrome/puppeteer/tree/master/examples/)\n- [Community list of Puppeteer resources](https://github.com/transitive-bullshit/awesome-puppeteer)\n\n\n<!-- [START debugging] -->\n\n## Debugging tips\n\n1. Turn off headless mode - sometimes it's useful to see what the browser is\n displaying. Instead of launching in headless mode, launch a full version of\n the browser using `headless: false`:\n\n const browser = await puppeteer.launch({headless: false});\n\n2. Slow it down - the `slowMo` option slows down Puppeteer operations by the\n specified amount of milliseconds. It's another way to help see what's going on.\n\n const browser = await puppeteer.launch({\n headless: false,\n slowMo: 250 // slow down by 250ms\n });\n\n3. Capture console output - You can listen for the `console` event.\n This is also handy when debugging code in `page.evaluate()`:\n\n page.on('console', msg => console.log('PAGE LOG:', msg.text()));\n\n await page.evaluate(() => console.log(`url is ${location.href}`));\n\n4. Stop test execution and use a debugger in browser\n\n - Use `{devtools: true}` when launching Puppeteer:\n\n `const browser = await puppeteer.launch({devtools: true});`\n\n - Change default test timeout:\n\n jest: `jest.setTimeout(100000);`\n\n jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`\n\n mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>