SlideShare a Scribd company logo
Chrome DevTools Protocol
via Selenium
5 Selenium
• / Kazuaki Matsuo, KazuCocoa
• HeadSpin, Inc.
• Senior Software Engineer, Device Automation
• ex-Cookpad ACCESS
• https://www.headspin.io/
• OSS
• Appium project
• Chrome DevTools Protocol
• https://chromedevtools.github.io/devtools-protocol/
• Chrome DevTools Protocol via Selenium/Appium
• Chrome DevTools Protocol
• https://chromedevtools.github.io/devtools-protocol/
• Chrome DevTools Protocol via Selenium/Appium
Chrome DevTools Protocol
• Google Chrome browser
• https://developers.google.com/web/tools/chrome-devtools/
• ( Chrome )
chrome://inspect —remote-debugger-port=9222
Chrome Devtools Protocol via Selenium/Appium (Japanese)
WebSocket
=> {"id":1,"method":"Network.enable","params":{"maxPostDataSize":65536}}
=> {"id":2,"method":"Page.enable"}
=> {"id":3,"method":"Page.getResourceTree"}
=> {"id":4,"method":"Runtime.enable"}
=> {"id":5,"method":"Debugger.enable","params":{"maxScriptsCacheSize":10000000}}
=> {"id":6,"method":"Debugger.setPauseOnExceptions","params":{"state":"none"}}
=> {"id":7,"method":"Debugger.setAsyncCallStackDepth","params":{"maxDepth":32}}
=> {"id":8,"method":"Profiler.enable"}
=> {"id":9,"method":"Log.enable"}
=> {"id":10,"method":"Log.startViolationsReport","params":{"config":[{"name":"longTask","threshold":200},
{"name":"longLayout","threshold":30},{"name":"blockedEvent","threshold":100},{"name":"blockedParser","threshold":-1},
{"name":"handler","threshold":150},{"name":"recurringHandler","threshold":50},
{"name":"discouragedAPIUse","threshold":-1}]}}
=> {"id":11,"method":"DOM.enable"}
=> {"id":12,"method":"CSS.enable"}
=> {"id":13,"method":"Overlay.enable"}
….
CDP
• Google Chrome browser
• https://developers.google.com/web/tools/chrome-devtools/
• ( Chrome )
• ” ”
• Pupetter
• https://github.com/addyosmani/puppeteer-webperf
• HeadSpin
• CDP …
• JS
• Chrome DevTools Protocol
• https://chromedevtools.github.io/devtools-protocol/
• Chrome DevTools Protocol via Selenium/Appium
Chrome Devtools via Selenium
https://source.chromium.org/chromium/chromium/src/+/master:chrome/test/chromedriver/server/http_handler.cc;l=885?q=%2Fcdp%2Fexecute&ss=chromium&originalUrl=https:%2F
CDP via Selenium
ChromeDriver
port: 9515
Selenium clients
:
POST, /session/{session-id}/goog/cdp/execute
CDP via Selenium
ChromeDriver
port: 9515
Selenium clients
:
POST, /session/{session-id}/goog/cdp/execute
ChromeDriver
remote-debugger-address
CDP Selenium
> driver = Selenium::WebDriver.for :chrome, url: 'http://localhost:9515'
=> #<Selenium::WebDriver::Chrome::Driver:0x4d11f74261f6ab42 browser=:chrome>
> driver.get 'http://youtube.com'
=> nil
> driver.execute_cdp 'Browser.getVersion'
=> {"jsVersion"=>"8.1.307.32",
"product"=>"Chrome/81.0.4044.138",
"protocolVersion"=>"1.3",
"revision"=>"@8c6c7ba89cc9453625af54f11fd83179e23450fa",
"userAgent"=>
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/81.0.4044.138 Safari/537.36”}
> driver.execute_cdp ‘Page.navigate’, { url: ‘http://www.selenium.jp/’ }
remote-debugger-address …?
ChromeDriver
port: 9515
Selenium clients
:
POST, /session/{session-id}/goog/cdp/execute
ChromeDriver
remote-debugger-address
-remote-debugger-address
> driver.session_storage
-remote-debugger-address
> driver.session_storage
=> #<Selenium::WebDriver::HTML5::SessionStorage:0x00007fcf3802a418
@bridge=
#<Selenium::WebDriver::Remote::W3C::Bridge:0x00007fcf6010bd50
@browser=:chrome,
@capabilities=
#<Selenium::WebDriver::Remote::W3C::Capabilities:0x00007fcf6010bdc8
@capabilities=
{:proxy=>nil,
:browser_name=>"chrome",
……
{"chromedriverVersion"=>
"80.0.3987.106 (f68069574609230cf9b635cd784cfb1bf81bb53a-refs/branch-heads/3987@{#882})",
"userDataDir"=>
"/var/folders/34/2222sh8n27d6rcp7jqlkw8km0000gn/T/.com.google.Chrome.N74Q8x"},
"goog:chromeOptions"=>{"debuggerAddress"=>"localhost:53224"},
"networkConnectionEnabled"=>false,
"setWindowRect"=>true,
"strictFileInteractability"=>false,
"unhandledPromptBehavior"=>"dismiss and notify"}>,
@file_detector=nil,
CURL
• CURL Selenium
• curl -X POST http://localhost:9515/session/{session_id}/goog/cdp/execute
-d '{"cmd": "Browser.getVersion", "params": {}}’
• ‘goog’ vendor
• MicrosoftEdge ’ms’
• webdriverio Pupetter
CURL CDP
CURL
curl -X POST http://localhost:9515/session/{session_id}/goog/cdp/execute -d '{"cmd": "Browser.getVersion", "params": {}}’
> {"value":{"jsVersion":"8.1.307.32","product":"Chrome/
81.0.4044.138","protocolVersion":"1.3","revision":"@8c6c7ba89cc9453625af54f11fd83179e23450fa","userAgent":"Mozilla/5.0 (Macintos
Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36”}}
Appium Android Chrome
CDP
Android Chrome
• Appium CDP Chrome
• Appium 1.18.0
require 'appium_lib_core'
@core = Appium::Core.for url: 'http://localhost:4723/wd/hub', desired_capabilities: {
"deviceName": "Android",
"automationName": "UiAutomator2",
"autoAcceptsAlerts": "true",
"platformName": "Android",
"browserName": "chrome"
}
@driver = @core.start_driver
@driver.execute_cdp 'Browser.getVersion'
=> {"jsVersion"=>"6.9.427.23",
"product"=>"Chrome/69.0.3497.100",
"protocolVersion"=>"1.3",
"revision"=>"@8920e690dd011895672947112477d10d5c8afb09",
"userAgent"=>
"Mozilla/5.0 (Linux; Android 9; Android SDK built for x86_64 Build/PSR1.180720.093)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Mobile Safari/537.36"}
Appium
[HTTP] --> POST /wd/hub/session/11d6751a-def1-4a1d-a401-2d928bdf3065/goog/cdp/execute
[HTTP] {"cmd":"Browser.getVersion","params":{}}
[W3C (11d6751a)] Driver proxy active, passing request on via HTTP proxy
[debug] [WD Proxy] Matched '/wd/hub/session/11d6751a-def1-4a1d-a401-2d928bdf3065/goog/cdp/execute' to
command name 'executeCdp'
[debug] [WD Proxy] Proxying [POST /wd/hub/session/11d6751a-def1-4a1d-a401-2d928bdf3065/goog/cdp/
execute] to [POST http://127.0.0.1:8000/wd/hub/session/d54ca3ff98f09fa0a4c11ce14705b9e1/goog/cdp/
execute] with body: {"cmd":"Browser.getVersion","params":{}}
[debug] [WD Proxy] Got response with status 200:
{"sessionId":"d54ca3ff98f09fa0a4c11ce14705b9e1","status":0,"value":{"jsVersion":"6.9.427.23","product":"Chrome/
69.0.3497.100","protocolVersion":"1.3","revision":"@8920e690dd011895672947112477d10d5c8afb09","userAgent":"
Mozilla/5.0 (Linux; Android 9; Android SDK built for x86_64 Build/PSR1.180720.093) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/69.0.3497.100 Mobile Safari/537.36"}}
[WD Proxy] Replacing sessionId d54ca3ff98f09fa0a4c11ce14705b9e1 with 11d6751a-def1-4a1d-
a401-2d928bdf3065
[HTTP] <-- POST /wd/hub/session/11d6751a-def1-4a1d-a401-2d928bdf3065/goog/cdp/execute 200 411 ms - 388
[HTTP]
• Chrome DevTools Protocol
• Chrome DevTools Protocol via Selenium/Appium
: playwright
• pipe Chrome CDP
• https://github.com/microsoft/playwright/blob/master/src/server/
chromium.ts#L177
• https://github.com/microsoft/playwright/tree/master/
browser_patches
Twitter: @Kazu_cocoa

More Related Content

What's hot (20)

PDF
Node.js vs Play Framework
Yevgeniy Brikman
 
PDF
The Play Framework at LinkedIn
Yevgeniy Brikman
 
PDF
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Max Andersen
 
PDF
Write php deploy everywhere tek11
Michelangelo van Dam
 
PDF
Automatic Functional Testing with Selenium and SauceLabs
Joseph Chiang
 
PDF
Night Watch with QA
Carsten Sandtner
 
PPTX
Cache is King
Steve Souders
 
ODP
CodeIgniter PHP MVC Framework
Bo-Yi Wu
 
PPTX
Angularjs Tutorial for Beginners
rajkamaltibacademy
 
PDF
Hitchhiker's guide to the front end development
정윤 김
 
PDF
Configuring CQ Security
connectwebex
 
PDF
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
Mikhail Egorov
 
PPTX
Web driver training
Dipesh Bhatewara
 
PDF
Hunting for security bugs in AEM webapps
Mikhail Egorov
 
PDF
Selenium webdriver
sean_todd
 
PDF
Search and play more than 50 clips
phanhung20
 
PDF
淺談 Geb 網站自動化測試(JCConf 2014)
Kyle Lin
 
PDF
Rock-solid Magento Development and Deployment Workflows
AOE
 
PDF
iOS Parallel Automation: run faster than fast — Viktar Karanevich — SeleniumC...
Badoo
 
PPTX
Enough with the JavaScript already!
Nicholas Zakas
 
Node.js vs Play Framework
Yevgeniy Brikman
 
The Play Framework at LinkedIn
Yevgeniy Brikman
 
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Max Andersen
 
Write php deploy everywhere tek11
Michelangelo van Dam
 
Automatic Functional Testing with Selenium and SauceLabs
Joseph Chiang
 
Night Watch with QA
Carsten Sandtner
 
Cache is King
Steve Souders
 
CodeIgniter PHP MVC Framework
Bo-Yi Wu
 
Angularjs Tutorial for Beginners
rajkamaltibacademy
 
Hitchhiker's guide to the front end development
정윤 김
 
Configuring CQ Security
connectwebex
 
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
Mikhail Egorov
 
Web driver training
Dipesh Bhatewara
 
Hunting for security bugs in AEM webapps
Mikhail Egorov
 
Selenium webdriver
sean_todd
 
Search and play more than 50 clips
phanhung20
 
淺談 Geb 網站自動化測試(JCConf 2014)
Kyle Lin
 
Rock-solid Magento Development and Deployment Workflows
AOE
 
iOS Parallel Automation: run faster than fast — Viktar Karanevich — SeleniumC...
Badoo
 
Enough with the JavaScript already!
Nicholas Zakas
 

Similar to Chrome Devtools Protocol via Selenium/Appium (Japanese) (20)

PDF
vodQA Pune (2019) - Browser automation using dev tools
vodQA
 
PPTX
Alfresco Development Framework Basic
Mario Romano
 
PDF
Complete_QA_Automation_Guide__1696637878.pdf
ramya9288
 
KEY
Android lessons you won't learn in school
Michael Galpin
 
PPTX
OWASP ZAP Workshop for QA Testers
Javan Rasokat
 
PPTX
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
Ciklum Ukraine
 
PPTX
Firefox OS - The platform you deserve - Athens App Days - 2013-11-27
Frédéric Harper
 
PDF
Client-Side Performance Monitoring (MobileTea, Rome)
Andrew Rota
 
PDF
Mobile Web Development with HTML5
Roy Clarkson
 
PDF
Behavior Driven Development and Automation Testing Using Cucumber
KMS Technology
 
KEY
An Introduction to webOS
Kevin Decker
 
PDF
Integration Test Cucumber + Webrat + Selenium
tka
 
PDF
Securing Microservices using Play and Akka HTTP
Rafal Gancarz
 
PDF
Rails Security
Wen-Tien Chang
 
PPTX
Gocd – Kubernetes/Nomad Continuous Deployment
Leandro Totino Pereira
 
PPTX
Learn Electron for Web Developers
Kyle Cearley
 
PDF
Web dev tools review
Changhyun Lee
 
PDF
[Struyf] Automate Your Tasks With Azure Functions
European Collaboration Summit
 
PDF
Introduction to Robot Framework
Somkiat Puisungnoen
 
PPTX
Plugins on OnDemand with Remote Apps - Atlassian Summit 2012
Atlassian
 
vodQA Pune (2019) - Browser automation using dev tools
vodQA
 
Alfresco Development Framework Basic
Mario Romano
 
Complete_QA_Automation_Guide__1696637878.pdf
ramya9288
 
Android lessons you won't learn in school
Michael Galpin
 
OWASP ZAP Workshop for QA Testers
Javan Rasokat
 
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
Ciklum Ukraine
 
Firefox OS - The platform you deserve - Athens App Days - 2013-11-27
Frédéric Harper
 
Client-Side Performance Monitoring (MobileTea, Rome)
Andrew Rota
 
Mobile Web Development with HTML5
Roy Clarkson
 
Behavior Driven Development and Automation Testing Using Cucumber
KMS Technology
 
An Introduction to webOS
Kevin Decker
 
Integration Test Cucumber + Webrat + Selenium
tka
 
Securing Microservices using Play and Akka HTTP
Rafal Gancarz
 
Rails Security
Wen-Tien Chang
 
Gocd – Kubernetes/Nomad Continuous Deployment
Leandro Totino Pereira
 
Learn Electron for Web Developers
Kyle Cearley
 
Web dev tools review
Changhyun Lee
 
[Struyf] Automate Your Tasks With Azure Functions
European Collaboration Summit
 
Introduction to Robot Framework
Somkiat Puisungnoen
 
Plugins on OnDemand with Remote Apps - Atlassian Summit 2012
Atlassian
 
Ad

More from Kazuaki Matsuo (20)

PDF
2022-jasst-tohoku.pdf
Kazuaki Matsuo
 
PDF
20210616-career-example-at-icare
Kazuaki Matsuo
 
PDF
Xcode 11におけるXCUITestの挙動
Kazuaki Matsuo
 
PDF
20191130 system-automation-conference
Kazuaki Matsuo
 
PDF
Uncovering breaking changes behind UI on mobile applications
Kazuaki Matsuo
 
PDF
Start contributing to OSS projects on your way
Kazuaki Matsuo
 
PDF
Go ahead outside Japan
Kazuaki Matsuo
 
PDF
CookpadTechConf2018-(Mobile)TestAutomation
Kazuaki Matsuo
 
PDF
20171215 andoird-test-night
Kazuaki Matsuo
 
PDF
20170726 ios test_night_no
Kazuaki Matsuo
 
PDF
20170701 lets-step-into-the-oss-community
Kazuaki Matsuo
 
PDF
20170613 tech easy
Kazuaki Matsuo
 
PDF
20170529 clem kazuaki_matsuo
Kazuaki Matsuo
 
PDF
20150423 m3
Kazuaki Matsuo
 
PDF
20170302 tryswift tasting_tests
Kazuaki Matsuo
 
PDF
20161126 to ruby
Kazuaki Matsuo
 
PDF
20160914 te engineer
Kazuaki Matsuo
 
PDF
20160913 cookpad ios_jp
Kazuaki Matsuo
 
PDF
20160913 cookpad ios_en
Kazuaki Matsuo
 
PDF
Toteka 04
Kazuaki Matsuo
 
2022-jasst-tohoku.pdf
Kazuaki Matsuo
 
20210616-career-example-at-icare
Kazuaki Matsuo
 
Xcode 11におけるXCUITestの挙動
Kazuaki Matsuo
 
20191130 system-automation-conference
Kazuaki Matsuo
 
Uncovering breaking changes behind UI on mobile applications
Kazuaki Matsuo
 
Start contributing to OSS projects on your way
Kazuaki Matsuo
 
Go ahead outside Japan
Kazuaki Matsuo
 
CookpadTechConf2018-(Mobile)TestAutomation
Kazuaki Matsuo
 
20171215 andoird-test-night
Kazuaki Matsuo
 
20170726 ios test_night_no
Kazuaki Matsuo
 
20170701 lets-step-into-the-oss-community
Kazuaki Matsuo
 
20170613 tech easy
Kazuaki Matsuo
 
20170529 clem kazuaki_matsuo
Kazuaki Matsuo
 
20150423 m3
Kazuaki Matsuo
 
20170302 tryswift tasting_tests
Kazuaki Matsuo
 
20161126 to ruby
Kazuaki Matsuo
 
20160914 te engineer
Kazuaki Matsuo
 
20160913 cookpad ios_jp
Kazuaki Matsuo
 
20160913 cookpad ios_en
Kazuaki Matsuo
 
Toteka 04
Kazuaki Matsuo
 
Ad

Recently uploaded (20)

PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PDF
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
Tally software_Introduction_Presentation
AditiBansal54083
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 

Chrome Devtools Protocol via Selenium/Appium (Japanese)

  • 1. Chrome DevTools Protocol via Selenium 5 Selenium
  • 2. • / Kazuaki Matsuo, KazuCocoa • HeadSpin, Inc. • Senior Software Engineer, Device Automation • ex-Cookpad ACCESS • https://www.headspin.io/ • OSS • Appium project
  • 3. • Chrome DevTools Protocol • https://chromedevtools.github.io/devtools-protocol/ • Chrome DevTools Protocol via Selenium/Appium
  • 4. • Chrome DevTools Protocol • https://chromedevtools.github.io/devtools-protocol/ • Chrome DevTools Protocol via Selenium/Appium
  • 5. Chrome DevTools Protocol • Google Chrome browser • https://developers.google.com/web/tools/chrome-devtools/ • ( Chrome )
  • 8. WebSocket => {"id":1,"method":"Network.enable","params":{"maxPostDataSize":65536}} => {"id":2,"method":"Page.enable"} => {"id":3,"method":"Page.getResourceTree"} => {"id":4,"method":"Runtime.enable"} => {"id":5,"method":"Debugger.enable","params":{"maxScriptsCacheSize":10000000}} => {"id":6,"method":"Debugger.setPauseOnExceptions","params":{"state":"none"}} => {"id":7,"method":"Debugger.setAsyncCallStackDepth","params":{"maxDepth":32}} => {"id":8,"method":"Profiler.enable"} => {"id":9,"method":"Log.enable"} => {"id":10,"method":"Log.startViolationsReport","params":{"config":[{"name":"longTask","threshold":200}, {"name":"longLayout","threshold":30},{"name":"blockedEvent","threshold":100},{"name":"blockedParser","threshold":-1}, {"name":"handler","threshold":150},{"name":"recurringHandler","threshold":50}, {"name":"discouragedAPIUse","threshold":-1}]}} => {"id":11,"method":"DOM.enable"} => {"id":12,"method":"CSS.enable"} => {"id":13,"method":"Overlay.enable"} ….
  • 9. CDP • Google Chrome browser • https://developers.google.com/web/tools/chrome-devtools/ • ( Chrome )
  • 10. • ” ” • Pupetter • https://github.com/addyosmani/puppeteer-webperf • HeadSpin • CDP … • JS
  • 11. • Chrome DevTools Protocol • https://chromedevtools.github.io/devtools-protocol/ • Chrome DevTools Protocol via Selenium/Appium
  • 12. Chrome Devtools via Selenium https://source.chromium.org/chromium/chromium/src/+/master:chrome/test/chromedriver/server/http_handler.cc;l=885?q=%2Fcdp%2Fexecute&ss=chromium&originalUrl=https:%2F
  • 13. CDP via Selenium ChromeDriver port: 9515 Selenium clients : POST, /session/{session-id}/goog/cdp/execute
  • 14. CDP via Selenium ChromeDriver port: 9515 Selenium clients : POST, /session/{session-id}/goog/cdp/execute ChromeDriver remote-debugger-address
  • 16. > driver = Selenium::WebDriver.for :chrome, url: 'http://localhost:9515' => #<Selenium::WebDriver::Chrome::Driver:0x4d11f74261f6ab42 browser=:chrome> > driver.get 'http://youtube.com' => nil > driver.execute_cdp 'Browser.getVersion' => {"jsVersion"=>"8.1.307.32", "product"=>"Chrome/81.0.4044.138", "protocolVersion"=>"1.3", "revision"=>"@8c6c7ba89cc9453625af54f11fd83179e23450fa", "userAgent"=> "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36”} > driver.execute_cdp ‘Page.navigate’, { url: ‘http://www.selenium.jp/’ }
  • 17. remote-debugger-address …? ChromeDriver port: 9515 Selenium clients : POST, /session/{session-id}/goog/cdp/execute ChromeDriver remote-debugger-address
  • 19. -remote-debugger-address > driver.session_storage => #<Selenium::WebDriver::HTML5::SessionStorage:0x00007fcf3802a418 @bridge= #<Selenium::WebDriver::Remote::W3C::Bridge:0x00007fcf6010bd50 @browser=:chrome, @capabilities= #<Selenium::WebDriver::Remote::W3C::Capabilities:0x00007fcf6010bdc8 @capabilities= {:proxy=>nil, :browser_name=>"chrome", …… {"chromedriverVersion"=> "80.0.3987.106 (f68069574609230cf9b635cd784cfb1bf81bb53a-refs/branch-heads/3987@{#882})", "userDataDir"=> "/var/folders/34/2222sh8n27d6rcp7jqlkw8km0000gn/T/.com.google.Chrome.N74Q8x"}, "goog:chromeOptions"=>{"debuggerAddress"=>"localhost:53224"}, "networkConnectionEnabled"=>false, "setWindowRect"=>true, "strictFileInteractability"=>false, "unhandledPromptBehavior"=>"dismiss and notify"}>, @file_detector=nil,
  • 20. CURL • CURL Selenium • curl -X POST http://localhost:9515/session/{session_id}/goog/cdp/execute -d '{"cmd": "Browser.getVersion", "params": {}}’ • ‘goog’ vendor • MicrosoftEdge ’ms’ • webdriverio Pupetter
  • 22. CURL curl -X POST http://localhost:9515/session/{session_id}/goog/cdp/execute -d '{"cmd": "Browser.getVersion", "params": {}}’ > {"value":{"jsVersion":"8.1.307.32","product":"Chrome/ 81.0.4044.138","protocolVersion":"1.3","revision":"@8c6c7ba89cc9453625af54f11fd83179e23450fa","userAgent":"Mozilla/5.0 (Macintos Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36”}}
  • 24. Android Chrome • Appium CDP Chrome • Appium 1.18.0
  • 25. require 'appium_lib_core' @core = Appium::Core.for url: 'http://localhost:4723/wd/hub', desired_capabilities: { "deviceName": "Android", "automationName": "UiAutomator2", "autoAcceptsAlerts": "true", "platformName": "Android", "browserName": "chrome" } @driver = @core.start_driver @driver.execute_cdp 'Browser.getVersion' => {"jsVersion"=>"6.9.427.23", "product"=>"Chrome/69.0.3497.100", "protocolVersion"=>"1.3", "revision"=>"@8920e690dd011895672947112477d10d5c8afb09", "userAgent"=> "Mozilla/5.0 (Linux; Android 9; Android SDK built for x86_64 Build/PSR1.180720.093) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Mobile Safari/537.36"}
  • 26. Appium [HTTP] --> POST /wd/hub/session/11d6751a-def1-4a1d-a401-2d928bdf3065/goog/cdp/execute [HTTP] {"cmd":"Browser.getVersion","params":{}} [W3C (11d6751a)] Driver proxy active, passing request on via HTTP proxy [debug] [WD Proxy] Matched '/wd/hub/session/11d6751a-def1-4a1d-a401-2d928bdf3065/goog/cdp/execute' to command name 'executeCdp' [debug] [WD Proxy] Proxying [POST /wd/hub/session/11d6751a-def1-4a1d-a401-2d928bdf3065/goog/cdp/ execute] to [POST http://127.0.0.1:8000/wd/hub/session/d54ca3ff98f09fa0a4c11ce14705b9e1/goog/cdp/ execute] with body: {"cmd":"Browser.getVersion","params":{}} [debug] [WD Proxy] Got response with status 200: {"sessionId":"d54ca3ff98f09fa0a4c11ce14705b9e1","status":0,"value":{"jsVersion":"6.9.427.23","product":"Chrome/ 69.0.3497.100","protocolVersion":"1.3","revision":"@8920e690dd011895672947112477d10d5c8afb09","userAgent":" Mozilla/5.0 (Linux; Android 9; Android SDK built for x86_64 Build/PSR1.180720.093) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Mobile Safari/537.36"}} [WD Proxy] Replacing sessionId d54ca3ff98f09fa0a4c11ce14705b9e1 with 11d6751a-def1-4a1d- a401-2d928bdf3065 [HTTP] <-- POST /wd/hub/session/11d6751a-def1-4a1d-a401-2d928bdf3065/goog/cdp/execute 200 411 ms - 388 [HTTP]
  • 27. • Chrome DevTools Protocol • Chrome DevTools Protocol via Selenium/Appium
  • 28. : playwright • pipe Chrome CDP • https://github.com/microsoft/playwright/blob/master/src/server/ chromium.ts#L177 • https://github.com/microsoft/playwright/tree/master/ browser_patches