# NOT RUN {
# Assuming that an application is already running at http://localhost:9222
# For instance, you can execute:
# chrome <- Chrome$new()
remote <- CDPRemote$new()
remote$connect() %...>% (function(client) {
Page <- client$Page
Runtime <- client$Runtime
Page$enable() %...>% {
Page$navigate(url = 'http://r-project.org')
} %...>% {
Page$loadEventFired()
} %...>% {
Runtime$evaluate(
expression = 'document.documentElement.outerHTML'
)
} %...>% (function(result) {
cat(result$result$value, "\n")
}) %...!% {
cat("Error:", .$message, "\n")
} %>%
promises::finally(~ client$disconnect())
}) %...!% {
cat("Error:", .$message, "\n")
}
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab