Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
PuppeteerとPlaywrightの15日間の演劇 / relation of Pupp...
Search
taminif
February 12, 2020
Programming
2.3k
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
PuppeteerとPlaywrightの15日間の演劇 / relation of Puppeteer and Playwright
taminif
February 12, 2020
More Decks by taminif
See All by taminif
React Native New Architecture 移行実践報告
taminif
1
250
「とりあえずAI」が招く悲劇〜私がAIで生産性を下げるまでの話〜 / The tragedy caused by "AI for now" - The story of how I used AI to reduce my productivity
taminif
1
310
Redashの開発はじめました / How to get started Redash development
taminif
0
810
私の生活を変えたHeadless Chrome / Headless Chrome who changed my life
taminif
3
540
WebSocketをiOSに持ち込んで辛い思いをした経験がありますか!? / have you painful experience in web socket?
taminif
3
6.2k
LINEで馬券を購入する / Purchase a betting ticket at LINE
taminif
1
1.7k
SkyWayで一年間運用してきたけどWebRTCってつらいんじゃないの
taminif
2
1k
オンライン英会話とSkyWay
taminif
0
550
オンライン英会話アプリとSkyWay
taminif
0
500
Other Decks in Programming
See All in Programming
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
The ROI of Quarkus for Spring Boot Applications
hollycummins
0
150
技術的負債解消で開発者の未来を開く- AIの力でコード刷新
kmd2kmd
0
120
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
980
The NotImplementedError Problem in Ruby
koic
1
970
トークンをケチるな、設計しろ:GitHub Copilotを賢く使うコンテキスト戦略
ochtum
0
220
AIキャラアプリkaiwaの低遅延音声通話基盤をどう作ったか - AWS Gravitonで支える低遅延・低コストAI Agent基盤
mogamit
0
120
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
410
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
1
220
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
560
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
4
1.5k
AIで効率化できた業務・日常
ochtum
0
150
Featured
See All Featured
The Invisible Side of Design
smashingmag
301
52k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
260
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
250
The Pragmatic Product Professional
lauravandoore
37
7.3k
Typedesign – Prime Four
hannesfritz
42
3.1k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
120k
Transcript
PuppeteerͱPlaywrightͷ 15ؒͷԋܶ ؔNodeֶԂ 9࣌ݶ 2020/02/12 େౡ ޫو@sbntaminif
ࣗݾհ • ΣϒϦΦגࣜձࣾɹ։ൃGϦʔμʔ • ීஈژͰಇ͍͍ͯ·͢ • ۙگɹ໌͕ଉࢠͷ1ࡀͷੜͰ͢ ࠓ݄͔Βಋೖ͞Εͨه೦ٳՋͰ ໌͓ٳΈͰ͢
ϓϥΠϕʔτͰ։ൃ͢Δ͕࣌ؒ औΕ͍ͯͳ͍ࢲ͕ ٱ͠ͿΓʹPuppeteer͓͏ͱ ࢥͬͨ1݄15ͷग़དྷࣄ
2020/01/15
Microsoft EdgeͷChromium൛ ϦϦʔε https://support.microsoft.com/ja-jp/help/4501095/download-the-new-microsoft-edge-based-on-chromium
Puppeteer Chrome or ChromiumͰ ಈ࡞͢Δ
ಈ͘ͷ͔ݕূ͢Δ
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Λࢦఆ͢Δ͜ͱͰ ҙͷϒϥβͰ࣮ߦ -> ͳ͘ಈ͍ͨ
READMEʹ هࡌ͕͋Δ https://github.com/puppeteer/puppeteer#default-runtime-settings
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 ͰλϒΛ૿ͤΔ
MicrosoftެࣜDocsʹ Puppeteerͷϖʔδ͕Ͱ͖ͯΔ https://docs.microsoft.com/en-us/microsoft-edge/puppeteer
EdgeͰಈ͔͢ํ๏·Ͱ͋Δ https://docs.microsoft.com/en-us/microsoft-edge/puppeteer
͜ͷ࣌EdgeͰ ͍Ζ͍Ζ༡ͿͭΓͩͬͨ
Ұिؒޙʹ ಥݱΕͨPlaywright
2020/01/23
Playwright https://github.com/microsoft/playwright
Playwrightͱ • Chromium, Firefox, WebkitΛಈ͔͢ NodeϥΠϒϥϦ • ϔουϨεϞʔυՄೳ • Microsoft͔Βఏڙʢͨͩ͠·ͩVersion0.10.0ʣ
• It enables cross-browser web automation that is ever-green, capable, reliable and fast.
Puppeteerͱ Ͳ͏ҧ͏ͷ͔ʁ
࠷ॳPuppeteerͱಉ͡νʔϜ ಉ͡APIͱઆ໌͞Ε͍ͯͨ https://github.com/microsoft/playwright/tree/f03b64860f64e05e1e8bb41a952e999dbdf6b150#faq
2020/01/29
Puppeteer v2.1.0 ϦϦʔε
ެࣜͰFirefoxΛαϙʔτ https://twitter.com/mathias/status/1222183802870607872 'JSFGPYͰ1VQQFUFFS͕ ಈ͘Α͏ʹͳΓ·ͨ͠
͜ͷπΠʔτʹ࣭͕ࡴ౸ https://twitter.com/mathias/status/1222183802870607872
ಛʹ͜ͷπΠʔτ https://twitter.com/mathias/status/1222189671389835269 -> ͦΕͧΕผͷνʔϜͰ։ൃ -> Google͜Ε͔ΒPuppeteerΛαϙʔτ
͞Βʹ͜ͷπΠʔτ https://twitter.com/benedyktdryl/status/1222196512144416768 ͜͜ͰผνʔϜͰ͋Δ͜ͱ͕Θ͔Δ
͞Βʹ͞Βʹ͜ͷπΠʔτ https://twitter.com/kentcdodds/status/1222199111341838336 ͜͜ͰνʔϜ͕Ҡಈͨ͜͠ͱ͕Θ͔Δ
2020/01/28
Yang Guo͕READMEʹه https://github.com/microsoft/playwright/pull/711/files
ಥʹ໊લग़ͨ͠ͷͰ https://twitter.com/malfaitrobin/status/1222199209761345536 :BOH(VP ͜ͷਓͰ͢ :BOH(VP ͜ͷਓͰ͢ ͲͪΒ (PPHMFS
InfoQ͔͠هࣄ͕ݟ͔ͭΒͳ͍ t ͜͜Ͱͷ"OOPVODFT (JUIVCͷ͜ͱͬΆ͍
Microsoft͔ΒGoogle͔Β هࣄ͕ग़͍ͯͳ͍ͷͰ ެࣜใͪͰ͢
Playwright ͬͯΈͨ
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ͱҧ͏෦
ಈ͔ͳ͍෦͋Δ FirefoxͰwaitForSelector͕ ಈ͔ͳ͍ ʢࣗͷௐࠪෆ͔͠Εͳ͍ʣ
2020ͷϝδϟʔϦϦʔε͕ ظ͞Ε͍ͯΔ (͜ΕInfoQͷΈ)
ͦͯ͠Puppeteer ։ൃଓ͘
ͲͪΒΩϟονΞοϓͯ͠ ͍͖ͬͯ·͠ΐ͏ʂ
͋Γ͕ͱ͏͍͟͝·ͨ͠