Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Headless Browser Experiments
Search
Christian Bäuerlein
January 28, 2016
Programming
0
400
Headless Browser Experiments
A short journey about taking screenshots with headless browsers.
Christian Bäuerlein
January 28, 2016
Tweet
Share
More Decks by Christian Bäuerlein
See All by Christian Bäuerlein
Single File Ruby Programs @ RubyUnconf 2023
fabrik42
0
160
Single File Ruby Programs 2.0
fabrik42
1
210
Single File Ruby Programs
fabrik42
0
290
Agile Software Development for Software Developers
fabrik42
0
53
Phoenix Live View
fabrik42
0
610
Rails API-only considerations
fabrik42
0
370
Org-Mode
fabrik42
0
540
Flocking Simulation with Phoenix Channels
fabrik42
1
390
Cleaner, scalable views with object oriented components
fabrik42
0
370
Other Decks in Programming
See All in Programming
非同期処理の迷宮を抜ける: 初学者がつまづく構造的な原因
pd1xx
1
700
dotfiles 式年遷宮 令和最新版
masawada
1
750
愛される翻訳の秘訣
kishikawakatsumi
1
310
ViewファーストなRailsアプリ開発のたのしさ
sugiwe
0
440
手が足りない!兼業データエンジニアに必要だったアーキテクチャと立ち回り
zinkosuke
0
600
sbt 2
xuwei_k
0
260
俺流レスポンシブコーディング 2025
tak_dcxi
14
8.5k
堅牢なフロントエンドテスト基盤を構築するために行った取り組み
shogo4131
8
2.3k
Cap'n Webについて
yusukebe
0
130
関数実行の裏側では何が起きているのか?
minop1205
1
680
안드로이드 9년차 개발자, 프론트엔드 주니어로 커리어 리셋하기
maryang
1
110
JETLS.jl ─ A New Language Server for Julia
abap34
1
340
Featured
See All Featured
It's Worth the Effort
3n
187
29k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.7k
GitHub's CSS Performance
jonrohan
1032
470k
Rebuilding a faster, lazier Slack
samanthasiow
84
9.3k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
700
Designing Experiences People Love
moore
143
24k
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.2k
GraphQLの誤解/rethinking-graphql
sonatard
73
11k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
14k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Transcript
HEADLESS BROWSER EXPERIMENTS A short journey about taking screenshots with
headless browsers Christian Bäuerlein / @fabrik42
A headless browser is a web browser without a graphical
user interface.
PhantomJS SlimerJS CasperJS many more!
USE CASES Running test suites Web scraping / Automation Taking
screenshots
TAKING SCREENSHOTS
The project: A desktop website that lets users create a
custom mobile web app.
The challenges: How to render a list of created apps?
How to share your creations with others?
HTML IS NOT SHAREABLE URLs are easy to share. Textual
content is easy to share. Visual representations in HTML are not easy to share. But images are :)
SCREENSHOTS!
None
None
PHANTOMJS 1.X Good Just one binary Not So Good Project
was somehow stalled Bad No web font support :(
PHANTOMJS 2.0! Including web font support! *yay* Let's try again...
PROBLEM Present your work on a web page to somebody
who can't access it right now.
RESPONSIVE MOCKUPS github.com/fabrik42/responsive_mockups
RESPONSIVE MOCKUPS Takes screenshots of a webpage in different resolutions
and automatically applies it to mockup templates.
None
None
None
REQUIREMENTS Easy to install. No dependencies, if possible. Nice templates
to start right away.
EASY INSTALLATION brew install phantomjs git clone [responsive_mockups] && cd
responsive_mockups phantomjs example.js
EXAMPLE.JS var mockup = require('./index'); mockup.create({ url: 'https://flinc.org/home', template: 'flat_responsive_2',
output: 'my_mockup.png' });
HOW IT WORKS 1. User provides URL and template name.
2. PhantomJS generates screenshots based on different viewports. 3. PhantomJS assembles mockup image using a local HTML file and <canvas>.
None
None
None
None
None
None
None
None
RESPONSIVE MOCKUPS github.com/fabrik42/responsive_mockups
Mockup graphics are nice, but what about... MOCKUP PHOTOS?
None
None
DEMO TIME!
http://phantomjs.org/supported-web-standards.html WebGL CSS 3D Video and Audio The following features,
due to the nature of PhantomJS, are irrelevant:
None
Atom Editor Visual Studio Code Slack Mapbox Map Designer ...
nightmare.js!
Knows how to WebGL :)
None
ONE MORE THING...
Now that we mastered all kind of images, what about...
MOVIES!
None
STOP MOTION IN HTML & JS Create an animation Stop
at every frame Make a screenshot Go to the next frame
DEMO TIME!
Remember: We wanted to make things shareable.
CUSTOMIZED MOVIES!
Manipulate the movie while rendering the frames browser .evaluate(function (currentFrame)
{ stage.goto(currentFrame); }, currentFrame)
ADVANCED DEMO TIME!
Q & A Christian Bäuerlein github.com/fabrik42 twitter.com/fabrik42
[email protected]