Slide 1

Slide 1 text

HEADLESS BROWSER EXPERIMENTS A short journey about taking screenshots with headless browsers Christian Bäuerlein / @fabrik42

Slide 2

Slide 2 text

A headless browser is a web browser without a graphical user interface.

Slide 3

Slide 3 text

PhantomJS SlimerJS CasperJS many more!

Slide 4

Slide 4 text

USE CASES Running test suites Web scraping / Automation Taking screenshots

Slide 5

Slide 5 text

TAKING SCREENSHOTS

Slide 6

Slide 6 text

The project: A desktop website that lets users create a custom mobile web app.

Slide 7

Slide 7 text

The challenges: How to render a list of created apps? How to share your creations with others?

Slide 8

Slide 8 text

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 :)

Slide 9

Slide 9 text

SCREENSHOTS!

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

PHANTOMJS 1.X Good Just one binary Not So Good Project was somehow stalled Bad No web font support :(

Slide 13

Slide 13 text

PHANTOMJS 2.0! Including web font support! *yay* Let's try again...

Slide 14

Slide 14 text

PROBLEM Present your work on a web page to somebody who can't access it right now.

Slide 15

Slide 15 text

RESPONSIVE MOCKUPS github.com/fabrik42/responsive_mockups

Slide 16

Slide 16 text

RESPONSIVE MOCKUPS Takes screenshots of a webpage in different resolutions and automatically applies it to mockup templates.

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

REQUIREMENTS Easy to install. No dependencies, if possible. Nice templates to start right away.

Slide 21

Slide 21 text

EASY INSTALLATION brew install phantomjs git clone [responsive_mockups] && cd responsive_mockups phantomjs example.js

Slide 22

Slide 22 text

EXAMPLE.JS var mockup = require('./index'); mockup.create({ url: 'https://flinc.org/home', template: 'flat_responsive_2', output: 'my_mockup.png' });

Slide 23

Slide 23 text

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 .

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

RESPONSIVE MOCKUPS github.com/fabrik42/responsive_mockups

Slide 33

Slide 33 text

Mockup graphics are nice, but what about... MOCKUP PHOTOS?

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

DEMO TIME!

Slide 37

Slide 37 text

http://phantomjs.org/supported-web-standards.html WebGL CSS 3D Video and Audio The following features, due to the nature of PhantomJS, are irrelevant:

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

Atom Editor Visual Studio Code Slack Mapbox Map Designer ... nightmare.js!

Slide 40

Slide 40 text

Knows how to WebGL :)

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

ONE MORE THING...

Slide 43

Slide 43 text

Now that we mastered all kind of images, what about...

Slide 44

Slide 44 text

MOVIES!

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

STOP MOTION IN HTML & JS Create an animation Stop at every frame Make a screenshot Go to the next frame

Slide 47

Slide 47 text

DEMO TIME!

Slide 48

Slide 48 text

Remember: We wanted to make things shareable.

Slide 49

Slide 49 text

CUSTOMIZED MOVIES!

Slide 50

Slide 50 text

Manipulate the movie while rendering the frames browser .evaluate(function (currentFrame) { stage.goto(currentFrame); }, currentFrame)

Slide 51

Slide 51 text

ADVANCED DEMO TIME!

Slide 52

Slide 52 text

Q & A Christian Bäuerlein github.com/fabrik42 twitter.com/fabrik42 [email protected]