DevTools and Headless Chrome – The Automation Power-Couple

A presentation at FrontCon in June 2018 in Riga, Latvia by Yonatan Mevorach

Slide 1

Slide 1

Slide 2

Slide 2

DEVTOOLS & HEADLESS CHROME: THE AUTOMATION POWER-COUPLE

Slide 3

Slide 3

Yonatan Mevorach @cowchimp

Slide 4

Slide 4

Slide 5

Slide 5

Slide 6

Slide 6

Web Automation youtu.be/fsF7enQY8uI

Slide 7

Slide 7

”I can’t automate this” -- no one ever (after watching this talk)

Slide 8

Slide 8

Headless Browsers cbnd flic.kr/p/qnSPdN

Slide 9

Slide 9

Chrome

Slide 10

Slide 10

headless Chrome

Slide 11

Slide 11

Slide 12

Slide 12

Slide 13

Slide 13

[ { { { { { { { { { { { { { { { { ] "time": "time": "time": "time": "time": "time": "time": "time": "time": "time": "time": "time": "time": "time": "time": "time": "08:00 "09:00 "09:30 "10:05 "10:40 "11:10 "11:45 "12:20 "12:55 "13:55 "14:25 "15:00 "15:30 "16:05 "16:40 "19:00

09:00", "title": "Registration, Breakfast, and Booths Open" }, 09:30", "title": "Opening of the Conference" }, 10:00", "title": "DevTools and Headless Chrome – The Automation Power-Couple" }, 10:35", "title": "Web performance in large-scale applications" }, 11:10", "title": "Backends for frontends with GraphQL" }, 11:45", "title": "Break" }, 12:15", "title": "JavaScript security: a retrospective" }, 12:50", "title": "Moving Web applications into Virtual Reality" }, 13:50", "title": "Lunch" }, 14:20", "title": "OpenSpace opening" }, 14:55", "title": "Channel your inner rockstar with the web audio API." }, 15:25", "title": "Break" }, 16:00", "title": "Challenge Accepted: Scoping Errors in “Multi-App” Environment" }, 16:40", "title": "Getting rid of runtime errors with Elm" }, 17:00", "title": "Close Day" }, ...", "title": "Dinner and Party" }

Slide 14

Slide 14

Slide 15

Slide 15

Slide 16

Slide 16

Slide 17

Slide 17

Slide 18

Slide 18

Slide 19

Slide 19

Slide 20

Slide 20

Slide 21

Slide 21

Slide 22

Slide 22

Slide 23

Slide 23

Slide 24

Slide 24

Slide 25

Slide 25

headless Chrome

Slide 26

Slide 26

headless Firefox

Slide 27

Slide 27

Chrome DevTools

Slide 28

Slide 28

Slide 29

Slide 29

Slide 30

Slide 30

Slide 31

Slide 31

protocol Chrome DevTools

Slide 32

Slide 32

DevTools Embedding Frontendapp WebSockets ChromeAPI Headless Adapted from content by © Sami Kyöstilä, Google goo.gl/yQi9kZ

Slide 33

Slide 33

{ id: 1, method: "Runtime.evaluate", params: { expression: "1 + 1" } } DevTools Embedding Frontendapp ChromeAPI Headless Adapted from content by © Sami Kyöstilä, Google goo.gl/yQi9kZ

Slide 34

Slide 34

{ id: 1, method: "Runtime.evaluate", params: { expression: "1 + 1" } } DevTools Embedding Frontendapp ChromeAPI Headless { id: 1, result: { result: { type: "number", value: 2, description: "2" }, wasThrown: false } } Adapted from content by © Sami Kyöstilä, Google goo.gl/yQi9kZ

Slide 35

Slide 35

Slide 36

Slide 36

DevTools Embedding client app DevTools Headlesstarget API Adapted from content by © Sami Kyöstilä, Google goo.gl/yQi9kZ

Slide 37

Slide 37

node --inspect index.js

Slide 38

Slide 38

Slide 39

Slide 39

Slide 40

Slide 40

Slide 41

Slide 41

Slide 42

Slide 42

headless protocol

Slide 43

Slide 43

chrome --headless --remote-debugging-port=9222 https://frontcon.lv

Slide 44

Slide 44

chrome --headless --remote-debugging-port=9222 https://frontcon.lv

Slide 45

Slide 45

chrome --headless --remote-debugging-port=9222 https://frontcon.lv

Slide 46

Slide 46

chrome --headless --remote-debugging-port=9222 https://frontcon.lv

Slide 47

Slide 47

chrome --headless --remote-debugging-port=9222 https://frontcon.lv

Slide 48

Slide 48

Slide 49

Slide 49

Slide 50

Slide 50

Slide 51

Slide 51

Slide 52

Slide 52

Slide 53

Slide 53

Slide 54

Slide 54

Slide 55

Slide 55

Slide 56

Slide 56

Slide 57

Slide 57

Slide 58

Slide 58

Recap! goo.gl/j41BaC

Slide 59

Slide 59

tinyurl.com/ headless-talk @cowchimp blog.cowchimp.com