3

So I want to have a shiny app that has a button. When that button is clicked I want to use Selenium to scrape some information from some website. This is my sample code:

library(shiny)
library(RSelenium)

ui <- fluidPage(
  actionButton("button","CLICK ME")
)

server <- function(input, output, session) {

  observeEvent(input$button,{
    driver = rsDriver(browser = "firefox")
    driver$client$navigate("http://www.google.ca")
    Sys.sleep(5)
    driver$server$stop()
  })

}

shinyApp(ui, server)

On my local computer, this works fine. However, on shinyapps.io I get the following log message:

Selenium message:

Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line

I thought the problem might be that their system doesn't have a browser. So I tried to do:

system("sudo apt-get install firefox")

before starting the Selenium part but it required password since sudo and I don't know it.

Thanks for any help.

Cà phê đen
  • 1,883
  • 2
  • 21
  • 20

0 Answers0