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
330
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.3k
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
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
230
Japan Community Day at Kubecon + CloudNativeCon Japan 2026: Learning Container Privilege Control by Building My Own Low-Level Container Runtime
ternbusty
1
130
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
4
360
<title><a id="</title>君はこのHTMLをパースできるか"></a></title> #雑LT_study
pizzacat83
0
130
プロポーザルを書いてもらう
pvcresin
0
130
変わらないものが、変わるものを決める — 意図駆動開発 × イベントソーシング × イミュータブル | What Doesn't Change Decides What Can — IDD × Event Sourcing × Immutability
tomohisa
0
1.2k
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
200
PHP初心者セッション2026 〜生成AIでは見えない裏側を知る:今だからLAMPを通して仕組みを学ぶ〜
kashioka
0
820
jsmini JavaScript Engine を作ってみた話
yosuke_furukawa
PRO
0
290
言語を使う側から、作る側へ。 自作 Lisp で得た新たな気づき。
andpad
0
150
php-fpmのプロセスが枯渇した日-調査・対処・そして本当にやるべきだったこと-
shibuchaaaan
0
210
Go言語とトイモデルで学ぶTransformerの気持ち / fukuokago23-transformer
monochromegane
0
160
Featured
See All Featured
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
570
Statistics for Hackers
jakevdp
799
230k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
First, design no harm
axbom
PRO
2
1.2k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
200
Ruling the World: When Life Gets Gamed
codingconduct
0
290
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
240
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
830
Navigating Team Friction
lara
192
16k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
330
Balancing Empowerment & Direction
lara
6
1.2k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6k
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 ։ൃଓ͘
ͲͪΒΩϟονΞοϓͯ͠ ͍͖ͬͯ·͠ΐ͏ʂ
͋Γ͕ͱ͏͍͟͝·ͨ͠