Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PuppeteerとPlaywrightの15日間の演劇 / relation of Pupp...

taminif
February 12, 2020

PuppeteerとPlaywrightの15日間の演劇 / relation of Puppeteer and Playwright

taminif

February 12, 2020
Tweet

More Decks by taminif

Other Decks in Programming

Transcript

  1. const puppeteer = require('puppeteer'); (async () => { const browser

    = await puppeteer.launch({ headless: false, // executablePath: '/Applications/Vivaldi.app/Contents/ MacOS/Vivaldi' executablePath: '/Applications/Microsoft Edge.app/ Contents/MacOS/Microsoft Edge' }); const page = (await browser.pages())[0] || (await browser.newPage()); ɾ ɾ ɾ EdgeͷύεΛࢦఆ FYFDVUBCMF1BUIΛࢦఆ͢Δ͜ͱͰ ೚ҙͷϒϥ΢βͰ࣮ߦ -> ໰୊ͳ͘ಈ͍ͨ
  2. const puppeteer = require('puppeteer'); (async () => { const browser

    = await puppeteer.launch({ headless: false, // executablePath: '/Applications/Vivaldi.app/Contents/ MacOS/Vivaldi' executablePath: '/Applications/Microsoft Edge.app/ Contents/MacOS/Microsoft Edge' }); const page = (await browser.pages())[0] || (await browser.newPage()); ɾ ɾ ɾ Vivaldi͸ͪΐͬͱ͚ͩڍಈ͕ҧ͏ 7JWBMEJΛࢦఆͨ࣌͠ ʮελʔτϖʔδʯ͕͋Δঢ়ଶʢϒϥ΢βىಈ௚ޙʣ CSPXTFSOFX1BHF ͢Δͱ݁Ռ͕ฦͬͯ͜ͳ͍ λϒ͕ଘࡏ͢Δ৔߹͸ͦͷλϒΛ࢖͏͜ͱͰରԠ ʮελʔτϖʔδʯͰͳ͚Ε͹OFX1BHF ͰλϒΛ૿΍ͤΔ
  3. const { firefox, webkit, chromium } = require("playwright"); const loginPageUrl

    = 'https://order.yodobashi.com/yc/login/ index.html'; (async () => { // const browser = await webkit.launch(); // const browser = await chromium.launch({headless: false}); const browser = await firefox.launch({dumpio: true}); const context = await browser.newContext(); const page = await context.newPage(); await page.setViewport({width: 1920, height: 2000}); await page.goto(loginPageUrl, { waitUntil: 'networkidle2', }); ɾ ɾ ɾ ΄΅Puppeteerͱಉ͡ίʔυͰಈ͍ͨ 8FCLJUͷ৔߹ $ISPNJVNͷ৔߹ 'JSFGPYͷ৔߹ 1VQQFUFFSͱҧ͏෦෼