Troubleshooting: Opening Chrome Browser with RSelenium in Shinyapps.io

Hey Rstudio community!

I hope you're all doing great. 🌟 I'm currently facing a bit of a roadblock with hosting RSelenium on shinyapps.io, and I'm reaching out to the brilliant minds here for some guidance.

The Challenge:

I've been working on a Shiny app that involves RSelenium for some web scraping magic. Locally, everything is smooth sailing, but when I try to host it on shinyapps.io, I encounter a pesky error that's causing a bit of a headache.

The Error:

"Connecting to remote server"
Could not open chrome browser.
Client error message:
Undefined error in httr call. httr output: Failed to connect to localhost port 4567 after 0 ms: Connection refused
Check server log for further details.
Warning: Error in checkError: Undefined error in httr call. httr output: length(url) == 1 is not TRUE
15: <Anonymous>
13: fn
8: retry
7: connect$retryingStartServer
6: eval
5: eval
4: eval
3: eval
2: eval.parent
1: local

Shiny Code:

library(shiny)
library(RSelenium)
library(httr)  
library(pagedown)
library(curl)
library(netstat)

ui <- fluidPage(
  actionButton("btn", "Click Me!"),
  textOutput("txt"),
)

server <- function(input, output, session) {
  observeEvent(input$btn, {
    cDrv <- find_chrome()
    eCaps <- list(chromeOptions = list(
      args = c('--headless', '--disable-gpu', '--window-size=1280,800')
    ))
    client_server <- rsDriver(extraCapabilities = eCaps)

    remDr <- client_server$client
    remDr$navigate("http://www.google.com")
    remDr$maxWindowSize()
    title <- remDr$getTitle()
    output$txt <- renderText(as.character(title))
    remDr$quit()
  })
}

shinyApp(ui, server)

What I've Tried:

  • Checked dependencies locally, and everything is installed.
  • Used the latest version of RSelenium.
  • Set up appropriate configurations for the Chrome driver.

My Ask:

If anyone has faced a similar challenge or has experience with hosting RSelenium on shinyapps.io, your insights would be a game-changer! 🚀

How You Can Help:

  • Share your experiences, tips, or workarounds.
  • Suggest alternative solutions or optimizations.
  • Point me to relevant resources or documentation.

I'm open to any suggestions that could help me overcome this hurdle and make this project a success. Your expertise and support are immensely appreciated! 🙌

Thank you in advance for being an awesome community. Let's crack this code together!

Happy coding,

SaleForecast