Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
const devices = require('puppeteer/DeviceDescriptors');
let fetch = require('node-fetch');
let FormData = require('form-data');
let fs = require('fs');
let opener = require('opener');
it('スマートフォン版のスクリーンショットを撮影', async function () {
await page.emulate(devices['iPhone 6']);
await page.screenshot({
path: 'iphone6.png',
fullPage: true
// yabumiにアップロード
const formData = new FormData();
formData.append('imagedata', fs.createReadStream('iphone6.png'));
await fetch('', {
method: 'POST',
body: formData
.then(function (res) {
return res.json();
}).then(async function (json) {
if (json.url) {
await opener(json.url);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.