Description Usage Arguments Value Examples
When Chromium/Chrome is started in debugging mode, several HTTP endpoints are available. Using these endpoint, one can retrieve information from Chromium/Chrome or send commands, see https://chromedevtools.github.io/devtools-protocol/#endpoints.
1 2 3 4 5 6 7 8 9 10 11 12 13 | fetch_version(host = "localhost", port = 9222, secure = FALSE)
list_targets(host = "localhost", port = 9222, secure = FALSE)
fetch_protocol(host = "localhost", port = 9222, secure = FALSE, local = FALSE)
new_tab(host = "localhost", port = 9222, secure = FALSE, url = NULL)
activate_target(host = "localhost", port = 9222, secure = FALSE, target_id)
close_target(host = "localhost", port = 9222, secure = FALSE, target_id)
inspect_target(host = "localhost", port = 9222, secure = FALSE, target_id)
|
host |
Character scalar, the host name of the application. |
port |
The remote debugging port (a numeric or a character scalar). |
secure |
A logical indicating whether a secure protocol shall be used. |
local |
Logical scalar, indicating whether the local version of the
protocol (embedded in |
url |
URL to open in a new tab. |
target_id |
Target (or tab) identifier. |
fetch_version()
, list_targets()
, fetch_protocols()
and
new_tab()
return a list. activate_target()
and close_target()
returns
a logical: TRUE
is returned when the command succeeds, FALSE
is
returned if a wrong target_id
is provided.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## Not run:
chrome <- Chrome$new()
# fetch information about headless Chrome
fetch_version()
# fetch the Chromium/Chrome protocol
protocol <- fetch_protocol()
# get the list of opened tabs
list_targets()
# open an url in a new tab
new_target <- new_tab(url = "http://r-project.org")
# the new tab is referenced in the list of opened tabs
list_targets()
# inspect a target in a web browser
if(interactive()) inspect_target(target_id = new_target$id)
# close the previous created tab
close_target(target_id = new_target$id)
chrome$close()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.