When I try running an asynchronous function with crrri, I receive the error message: "Error: Cannot launch Chrome. Please add the path to your Chrome bin."
I guess the error message is trying to tell me that crrri cannot find my chrome executable. So I tried by adding the following code above my function definition (to the global env)
chrome <- Chrome$new(bin = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", debug_port = 9224L)
but the error message stayed the same.
This is the code I am trying to run:
library(crrri)
print_pdf <- function(client) {
Page <- client$Page
Page$enable() %...>% {
Page$navigate(
url = "https://r-project.org/"
)
# await the load event
Page$loadEventFired()
} %...>% {
Page$printToPDF()
} %...>% # await PDF reception
write_base64("r_project.pdf")
}
# To modify depending on the page
# content (JS libraries…)
perform_with_chrome(print_pdf)
The expected result would be a printed website to a pdf file saved to my PWD.