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
impression of google chrome headless
Search
teitei_tk
May 31, 2017
Programming
0
1.8k
impression of google chrome headless
teitei_tk
May 31, 2017
Tweet
Share
More Decks by teitei_tk
See All by teitei_tk
dive to Ruby on Rails module autoloading
teitei
1
4.1k
貴方はOmniAuth::AuthHashを知っていますか?
teitei
0
7.5k
myhome-progress
teitei
0
76
recommend parallel career
teitei
0
950
嫁に怒られずにGoを書く技術
teitei
0
2.4k
AWS parking lot shutter hack project
teitei
2
3.6k
Other Decks in Programming
See All in Programming
Composing an API the *right* way (Droidcon Berlin 2024)
zsmb
1
450
小さな開発会社を作った理由
polidog
0
1.9k
AWS初心者ってどうやってAWSを学ぶ?〜アプリエンジニアがやってよかったアーキテクチャ学習方法〜
yamanashi_ren01
0
190
Cloudflare Workers x AWS Lambdaの組み合わせユースケース / Cloudflare Workers x AWS Lambda Combination Use Case
seike460
PRO
2
310
最近追加した型の紹介とその振り返り
aki19035vc
0
170
日付と正規化
megmogmog1965
0
140
Prompt FlowによるLLMアプリケーション開発
yuto2000
1
1k
CSC307 Lecture 06
javiergs
PRO
0
360
Exploring the Gradually Lost Technical Skills in the Cloud Native Era
hwchiu
2
3.9k
Terraformテスト入門
msato
0
530
I/O Extended Android in Korea 2024 ~ Whats new in Android development tools
pluu
0
250
Activities at Cairo Library
cairolibrary720
0
1.2k
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
178
21k
Building Flexible Design Systems
yeseniaperezcruz
323
37k
Fashionably flexible responsive web design (full day workshop)
malarkey
399
65k
The Power of CSS Pseudo Elements
geoffreycrofte
64
5.2k
The Straight Up "How To Draw Better" Workshop
denniskardys
229
130k
Build The Right Thing And Hit Your Dates
maggiecrowley
28
2.2k
Happy Clients
brianwarren
94
6.5k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
90
47k
Fantastic passwords and where to find them - at NoRuKo
philnash
42
2.7k
Infographics Made Easy
chrislema
238
18k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
228
16k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
26
2.1k
Transcript
ChromeHeadless modeΛ৮ͬͨॴײ 2017/05/31 @teitei_tk
ࣗݾհ • @teitei_tk • ࠷ۙϋΠϥϧԦࠃΛฏʹ͢ΔͨΊʹؤுͬ ͯ·͢ɻ
ຊ
ͷલʹ
Chrome Headless ͱʁ
͍ΘΏΔHeadlessϒϥβ • ޡղΛঝͰݴ͑ɺGUIͷແ͍Chromeɻ • GUIͳ͍͕ɺ෦తʹϖʔδͷϨϯμϦϯά ͔ΒJavaScriptͷ࣮ߦɺϒϥβͬΆ͍͜ͱ͕ Ͱ͖Δ
Ͳ͏͍͏༻్͕͋Δͷ • WebApplicationͷςετ • ͍ΘΏΔE2E • WebPageͷΩϟϓνϟࡱӨ • WebαΠτͷεΫϨΠϐϯά •
DDoS߈ܸ
ͳͥ Chrome Headless͔
PhantomJSͷࢮ
PhantomJSͱ • HeadlessϒϥβͷҰͭ • ͓ͦΒ͘Ұ൪ਓؾ͕͋ΔͷͰͳ͍ͩΖ͏͔ • ͔͠͠ɺ2017/05/30ݱࡏͰissue1848ɺPull Request58ͱ։ൃఀ͍ͯ͠Δ • https://github.com/ariya/phantomjs/
PhantomJS is Dead • ͦͯ͠།Ұͷϝϯςφ͕ࠓޙΈͳChrome Headlessʹ Γ͑ΔͩΖ͏ͱϝϯςφΛࣙΛએݴɻ • https://groups.google.com/d/msg/phantomjs/9aI5d- LDuNE/5Z3SMZrqAQAJ
• ࠓޙͷߏ͋Δͷ͔ɺphantomiumͱ͍͏PhantomJS + ChromeHeadlessͷ୯ޠ͕Έ߹Θͬͨ͞ϨϙδτϦ͋ Δ • https://github.com/Vitallium/phantomium
ͱ͍͏ͷ͕എܠ
Կނ Chrome Headless͔
• Google͕։ൃ͍ͯ͠Δͱ͍͏҆৺ײ • Webඪ४ͷ४ڌ͕ૣ͍ͷͰɺ͍ͪૣ͘ػೳ͕͑Δɻ • ֤छAPIͷར༻͕Մೳ • ServiceWorker • IndexedDB
• Memory Heap Profiler • etc
ͱ͍͏Θ͚Ͱ ৮ͬͯΈͨ
Setup • Chrome Ver59Ҏ͕߱ඞਢ • ݱࡏ(2017/05/30)ͷChromeͷStable Version58 • Chrome CanaryΛ͏ͱྑͦ͞͏
؆୯ͳͷͳΒ͙͢ग़དྷΔ • ShellͰ͙͢ग़དྷΔ • DOMͷग़ྗ • PDF࡞ • Ωϟϓνϟͷऔಘ •
eg. $ chrome --headless --disable-gpu --dump- dom https://www.chromestatus.com/
దʹWrapperॻ͍ͨ • ΩϟϓνϟͷࡱӨ • https://wobfnz0lh2.execute-api.us- west-2.amazonaws.com/dev/chrome?url=https:// google.co.jp • PDFͷੜ •
https://wobfnz0lh2.execute-api.us- west-2.amazonaws.com/dev/pdf?url=https:// google.com/
• ݴޠɿNode.js • ओʹ༻ͨ͠ϥΠϒϥϦ • chrome-remote-interface • ChromeͷAPIΛୟ͘Node.jsϥΠϒϥϦ • lighthouse
• ChromeΛىಈ͢Δϔϧύʔ͕هࡌ͞Ε͍ͯΔ ϥΠϒϥϦ
ॴײ • ҆ఆԽ·Ͱ͏গֻ͔͠Γͦ͏ɻ • Ṗͷ--disable-gpu Option • API͕·ͩམͪண͍͍ͯͳ͍ͷͰຊ൪ೖ·ͩආ͚ͨ΄͏ ͕ྑͦ͞͏ •
ͱ͍͑PhantomJSͷޙ佂ʹ࠲Γͦ͏ɻ • ಈ͓͖ͬͯ·͢ɻ • Կ͔͋ͬͨΒهࣄͰॻ͍ͯڞ༗͠·͢ɻ