Skip to content
This repository was archived by the owner on Oct 25, 2023. It is now read-only.

feat: add calling chrome devtools endpoint for chromium - #405

Merged
KazuCocoa merged 3 commits into
appium:masterfrom
KazuCocoa:add-cdp
Apr 18, 2020
Merged

feat: add calling chrome devtools endpoint for chromium#405
KazuCocoa merged 3 commits into
appium:masterfrom
KazuCocoa:add-cdp

Conversation

@KazuCocoa

Copy link
Copy Markdown
Member

Chrome browser support /session/:sessionId/goog/cdp/execute endpoint.
Selenium bindings, afaik Java, Python and Ruby, have the endpoint.

We also can support it for chromebrowser. Below is an example.

> @driver.execute_cdp 'Page.getResourceTree'
=> {"frameTree"=>
  {"frame"=>{"id"=>"39B491DE0055515F0F352E11054854F9", "loaderId"=>"3E11DD1F2E9E020331C94E2E02E608E7", "mimeType"=>"text/plain", "securityOrigin"=>"://", "url"=>"data:,"},
   "resources"=>[{"contentSize"=>0, "mimeType"=>"text/plain", "type"=>"Document", "url"=>"data:,"}]}}

https://chromedevtools.github.io/devtools-protocol

Without this change, Appium returns below error.

[HTTP] --> POST /wd/hub/session/ba1e624d-d767-4059-a499-18e1aa330651/goog/cdp/execute
[HTTP] {"cmd":"Page.getResourceTree","params":{}}
[debug] [HTTP] No route found. Setting content type to 'text/plain'
[HTTP] <-- POST /wd/hub/session/ba1e624d-d767-4059-a499-18e1aa330651/goog/cdp/execute 404 9 ms - 111
[HTTP]

Comment thread lib/protocol/routes.js Outdated
// chromium devtools
// https://chromium.googlesource.com/chromium/src/+/master/chrome/test/chromedriver/server/http_handler.cc
'/session/:sessionId/goog/cdp/execute': {
POST: {}

@mykola-mokhnach mykola-mokhnach Apr 16, 2020

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and the command name

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I was modifying

Comment thread lib/protocol/routes.js Outdated

// chromium devtools
// https://chromium.googlesource.com/chromium/src/+/master/chrome/test/chromedriver/server/http_handler.cc
'/session/:sessionId/goog/cdp/execute': {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

goog is a vendor prefix in such case. It makes sense to replace it with a pattern matcher, like :vendor

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good 👍 like it.

@KazuCocoa
KazuCocoa merged commit d22c01f into appium:master Apr 18, 2020
@KazuCocoa
KazuCocoa deleted the add-cdp branch April 18, 2020 01:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants