Trouble Hosting RSelenium on shinyapps.io

Hey amazing community!

I hope you're all doing great. :star2: 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:

Quarto not found.
[2023-12-03T09:48:08.811850540+0000] Execute script: packages/build/RSelenium.sh
+ set -e
+ apt-get update -qq
W: http://cran.rstudio.com/bin/linux/ubuntu/jammy-cran40/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
+ DEBIAN_FRONTEND=noninteractive
+ apt-get install -y libssl-dev phantomjs
Reading package lists...
Building dependency tree...
Reading state information...
Package phantomjs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'phantomjs' has no installation candidate## End Task Log ################################################################
Error: Unhandled Exception: Child Task 1361911030 failed: Error building image: Build exited with non-zero status: 100
Execution halted

Shiny Code:

library(shiny)
library(wdman)
library(RSelenium)
library(httr)    
library(netstat)

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

server <- function(input, output, session) {
  observeEvent(input$btn, {
    #connect chrome driver
    client_server <- rsDriver(
      browser = "chrome",
      chromever = "119.0.5735.90",
      verbose = FALSE,
      port = free_port(),
    )
    
    # connect remote driver to client
    remDr <- client_server$client
    remDr$navigate("http://www.google.com")
    remDr$maxWindowSize()
    title <- remDr$getTitle()
    output$txt <- renderText(as.character(title))
    # clean up
    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! :rocket:

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! :raised_hands:

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

Happy coding,

SaleForecast

Hi,

Not sure I have the full picture because it looks to be failing on the phantomjs install:

apt-get install -y libssl-dev phantomjs

which means you might need to run something similar to linux - How can I set up & run PhantomJS on Ubuntu? - Stack Overflow or use npm like in some of the other answers there. However, your code looks like it doesn't use phamtomjs. So can that just be removed?